Home  >  Article  >  Database  >  JPA复合主键源码案例

JPA复合主键源码案例

WBOY
WBOYOriginal
2016-06-07 15:23:181288browse

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(); } } }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn