@ManyToOne referencing entity with @OneToOne relationship as primary key could cause org.hibernate.AnnotationException depending on referenced entity or package name
Description
Attachments
1
- 16 May 2019, 07:36 AM
Activity
Show:
Details
Details
Assignee
Unassigned
UnassignedReporter
Bartlomiej Niemiec
Bartlomiej NiemiecComponents
Affects versions
Priority
Created May 16, 2019 at 7:39 AM
Updated November 6, 2023 at 2:34 PM
Relationship like below:
@Entity public class EntityA implements Serializable { @Id private int id;
@Entity public class EntityB implements Serializable { @Id @OneToOne @JoinColumn(name = "a_ref_id") private EntityA entityA;
@Entity public class EntityC implements Serializable { @Id private String code; @ManyToOne @JoinColumn(name = "b_ref_id") private EntityB entityB;
could cause org.hibernate.AnnotationException:
javax.persistence.PersistenceException: [PersistenceUnit: fail_package_pu] Error performing schema management Caused by: org.hibernate.AnnotationException: A Foreign key refering com.jpatest.fail.db.EntityB from com.jpatest.fail.db.EntityC has the wrong number of column. should be 0
Occurring of this error depends on package name and entity name