Embedded (Java EE 5)

Java EE API


javax.persistence Annotation Type Embedded


@Target(value={METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface Embedded

Implements: Annotation
@Target(value={METHOD, FIELD})
@Retention(value=RUNTIME)

定义值为可嵌入类实例的实体的持久字段或属性。可嵌入的类必须注释为 Embeddable
示例:

   @Embedded
   @AttributeOverrides({
       @AttributeOverride(name="startDate",
           column=@Column("EMP_START")),
       @AttributeOverride(name="endDate", column=@Column("EMP_END"))
   })
   public EmploymentPeriod getEmploymentPeriod() { ... }
 
英文文档:

Defines a persistent field or property of an entity whose value is an instance of an embeddable class. The embeddable class must be annotated as Embeddable.

   Example:

   @Embedded
   @AttributeOverrides({
       @AttributeOverride(name="startDate",
           column=@Column("EMP_START")),
       @AttributeOverride(name="endDate", column=@Column("EMP_END"))
   })
   public EmploymentPeriod getEmploymentPeriod() { ... }
 

Since:
Java Persistence 1.0



Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!