I have a table which requires its primary key as a foreign key to other table, so an unidirectional one-to-one relationship. There will be only an author per book, like this:
@Entity
public class Author {
@Id
String code;
//getters and setters ...
}
@Entity
public class Book {
@Id
@OneToOne
@JoinColumn(name="code", columnDefinition="DOM_COD5")
Author author;
//getters and setters
}
With plain Hibernate and JPA annotations it works well, but using using it through Spring Data I keep getting this error:
Caused by: java.lang.IllegalArgumentException: This class [class com.xxxx.api.catalogo.domain.Book] does not define an IdClass