Dear All,
I got a problem on one-to-one mapping in a PrimaryKeyJoinColumn entity. An annotation error is shown like "unknown mapped by". My entity is inheritance from a base class Resource with strategy in single table. Each book may bundle with an unique cd. Thus I mapped with CdDisc class in One to one mapping
Code:
@Entity
@Table(name = "book")
@DiscriminatorValue("book")
@PrimaryKeyJoinColumn(name = "id")
public class Book extends Resource {
@OneToOne(optional = true)
@JoinColumn(name = "cd_nbr")
private CdDisc cd;
....
Code:
@Entity
@Table(name = "cd_disc")
public class CdDisc extends ModelBase {
@Id
@Column(name = "cd_nbr", nullable = false, unique = true)
private String cdNbr = "";
@OneToOne(mappedBy = "cd")
private Book book;
....
I think my syntax should be correct and I also have some other one to one mapping doing same like this. Only diff is one of entity is using PrimaryKeyJoinColumn to do. I'm greatly appreciate for any suggestion or idea to me. Thanks
Best Rdgs
Ellis