0
나는 Article entity와 ArticleCode entity를 가지고 있습니다. Aritcle Code에는 Forgeing Key라는 조항이 있지만 두 번째 및 세 번째 기본 키가 있습니다.jpa 이상 주요 키
Article isnt serializable이 가능하기 때문에 아래 예는 가능하지 않습니다. 어떤 아이디어?
감사합니다, 랄프
@Entity 공용 클래스 제 {
@Id @GeneratedValue (전략 = GenerationType.TABLE) 개인 롱 아이디;
public Long getId() { return id; }
}
@Entity @IdClass (com.google.gwt.sample.stockwatcher.server.huflattich.ArticleCode.ComposedIdKey.class) 공용 클래스 ArticleCode {
@Id
@OneToOne
private Article article;
@Id
@Column(name="coding_system")
private String codingSystem;
@Id
private String code;
...
public static class ComposedIdKey implements Serializable {
public Article article;
public String codingSystem;
public String code;
public ComposedIdKey() { }
public ComposedIdKey(Article article, String codingSystem, String code) {
this.article = article;
this.codingSystem = codingSystem;
this.code = code;
}
...
}
}