table 複合主鍵 同時使用 JAXB annotation設定
- 主pojo set @Id、@IdClass(xxx.class)、並設定@XmlElement
/** *主檔 */ @Entity @lombok.Data @lombok.ToString @Table(name="STORE_INFO") @XmlAccessorType(XmlAccessType.FIELD) @IdClass(StoreInfoPK.class) public class StoreInfo implements Serializable { private static final long serialVersionUID = 1L; @Id @XmlElement(name = "StoreId") private String storeId; @Id @XmlElement(name = "CreateTime") private Date createTime; /** * 店鋪店名 */ @XmlElement(name = "StoreName") @Column(name = "STORE_NAME") private String storeName; public SupStoreInfo() {} }
table 複合主鍵 並用 JAXB annotation設定
- PK pojo set @Column
/** *PK */ @lombok.Data @lombok.ToString public class StoreInfoPK implements Serializable { private static final long serialVersionUID = 1L; @Column(name="STORE_ID") private String storeId; @Column(name="CREATE_TIME") @Temporal(TemporalType.DATE) private Date createTime; public StoreInfoPK() { } }
文章標籤
全站熱搜
留言列表