|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
javax.persistence Annotation Type Enumerated
Implements:
Annotation
@Target(value={METHOD, FIELD})@Retention(value=RUNTIME)
指定应该做为枚举类型保留的持久属性或字段。它可以与
Basic
注释一起使用。
示例: public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT} public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE} @Entity public class Employee { public EmployeeStatus getStatus() {...} @Enumerated(STRING) public SalaryRate getPayScale() {...} ... }
since |
|
Specifies that a persistent property or field should be
persisted as a enumerated type. It may be used in conjunction
with the Basic
annotation.
Example: public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT} public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE} @Entity public class Employee { public EmployeeStatus getStatus() {...} @Enumerated(STRING) public SalaryRate getPayScale() {...} ... }
- Since:
- Java Persistence 1.0
Optional Element Summary | |
---|---|
EnumType |
value
(Optional) The type used in mapping an enum type. |
abstract public EnumType
value()
(可选)映射枚举类型时使用的类型。
英文文档:
value
public abstract EnumType value
- (Optional) The type used in mapping an enum type.
- Default:
- ORDINAL
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!