Hi,
Can someone help me with a problem?
I have the following case:
Code:
@Entity
@Table
public class EntityA {
@Id
@Column(name = "ID")
private Integer id;
...
}
@Entity
@Table
public class EntityB {
@Id
@ManyToOne(targetEntity = EntityA.class)
@JoinColumn(name = "ID")
private EntityA id;
...
}
@Entity
@Table
public class EntityC {
@Id
@ManyToOne(targetEntity = EntityB.class)
@JoinColumn(name = "ID")
private EntityB id;
...
}
I do not know what is happening. However when I try to run it, I got the follow error:
Code:
Caused by: A Foreign key refering EntityB from EntityC has the wrong number of column. should be 0
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:432)
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:117)
at org.hibernate.cfg.Configuration.processEndOfQueue(Configuration.java:1514)
at org.hibernate.cfg.Configuration.processFkSecondPassInOrder(Configuration.java:1437)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1355)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1724)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
... 10 more
What can I do to fix it?
However, I cannot change the current table relationships.
Thanks for the help.