|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: REQUIRED | OPTIONAL | 详细信息: ELEMENT | ||||||||
javax.persistence Annotation Type DiscriminatorColumn
Is used to define the discriminator column for the
SINGLE_TABLE and
JOINED inheritance mapping strategies.
The strategy and the discriminator column are only specified in the root of an entity class hierarchy or subhierarchy in which a different inheritance strategy is applied
If the DiscriminatorColumn annotation is missing,
and a discriminator column is required, the name of the
discriminator column defaults to "DTYPE" and the discriminator
type to DiscriminatorType.STRING.
Example:
@Entity
@Table(name="CUST")
@Inheritance(strategy=SINGLE_TABLE)
@DiscriminatorColumn(name="DISC", discriminatorType=STRING,length=20)
public class Customer { ... }
@Entity
public class ValuedCustomer extends Customer { ... }
- 从以下版本开始:
- Java Persistence 1.0
| Optional Element Summary | |
|---|---|
String |
columnDefinition
(Optional) The SQL fragment that is used when generating the DDL for the discriminator column. |
DiscriminatorType |
discriminatorType
(Optional) The type of object/column to use as a class discriminator. |
int |
length
(Optional) The column length for String-based discriminator types. |
String |
name
(Optional) The name of column to be used for the discriminator. |
name
public abstract String name
- (Optional) The name of column to be used for the discriminator.
- 默认值:
- "DTYPE"
discriminatorType
public abstract DiscriminatorType discriminatorType
- (Optional) The type of object/column to use as a class discriminator.
Defaults to
DiscriminatorType.STRING. - 默认值:
- STRING
columnDefinition
public abstract String columnDefinition
- (Optional) The SQL fragment that is used when generating the DDL
for the discriminator column.
Defaults to the provider-generated SQL to create a column of the specified discriminator type.
- 默认值:
- ""
length
public abstract int length
- (Optional) The column length for String-based discriminator types.
Ignored for other discriminator types.
- 默认值:
- 31
|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: REQUIRED | OPTIONAL | 详细信息: ELEMENT | ||||||||
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.