JPA复合主键源码案例

WBOY
發布: 2016-06-07 15:23:18
原創
1387 人瀏覽過

http://note.youdao.com/share/?id=9065b839f2d6b3f1b6310ad9bb92d3f6type=note @Entity@Table(name = RELEASE_INFO_ELEMENT)public class ReleaseInfoElement { @EmbeddedId private PK pk = new PK(); @Column(name = VALUE) private String value; public

http://note.youdao.com/share/?id=9065b839f2d6b3f1b6310ad9bb92d3f6&type=note

@Entity @Table(name = "RELEASE_INFO_ELEMENT") public class ReleaseInfoElement { @EmbeddedId private PK pk = new PK(); @Column(name = "VALUE") private String value; public Long getInfoId() { return pk.infoId; } public void setInfoId(Long infoId) { pk.infoId = infoId; } public Long getParamId() { return pk.paramId; } @Override public String toString() { return "ReleaseInfoElement [infoId=" + pk.infoId + ", paramId=" + pk.paramId + ", value=" + value + "]"; } public void setParamId(Long paramId) { pk.paramId = paramId; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Embeddable public static class PK implements Serializable { @Column(name = "INFO_ID") private Long infoId; @Column(name = "PARAM_ID") private Long paramId; public PK() { super(); } } }

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板