@TargetSE(valueSE={METHODSE,FIELDSE}) @RetentionSE(valueSE=RUNTIMESE) public @interface MapsId
EmbeddedId 主キー、EmbeddedId 主キー内の属性、親エンティティの単純な主キーのマッピングを提供する ManyToOne または OneToOne 関連属性を指定します。value エレメントは、リレーションシップ属性が対応する複合キー内の属性を指定します。エンティティの主キーが、リレーションシップによって参照されるエンティティの主キーと同じ Java 型である場合、value 属性は指定されません。
Example:
// parent entity has simple primary key
@Entity
public class Employee {
@Id long empId;
String name;
...
}
// dependent entity uses EmbeddedId for composite key
@Embeddable
public class DependentId {
String name;
long empid; // corresponds to primary key type of Employee
}
@Entity
public class Dependent {
@EmbeddedId DependentId id;
...
@MapsId("empid") // maps the empid attribute of embedded id
@ManyToOne Employee emp;
}
public abstract StringSE value
Copyright © 2019 Eclipse Foundation.
Use is subject to license terms.