則需要使用 @IdClass 指明其 primary key class
public class ObjectPrimaryKey implements Serializable {
// 宣告 @Id 的欄位為屬性
private String attributeId1 = null;
// CONSTRUCTORS
public ObjectPrimaryKey () { super(); }
// SETTER AND GETTER of attributes
// Override equals(), toString() and hashCode()
}
然後在 Object 上指明其 primary key class
@IdClass(AppDownloadTimesPrimaryKey.class)
public class Object {
// 在所有做為 primary key 之一的 attributes 要記得加上 @Id annotation
}
沒有留言:
張貼留言