Rather simple thing realy, but I'm doing something wrong it seems.
Entity A has a Set of AX which has Primary Key A.id and C.id pluss a value :)
Code:
...
@Entity
@Table(name="A")
public class A
{
@Id
@GeneratedValue(generator="SEQ_FELLES")
@SequenceGenerator(name="SEQ_FELLES", sequenceName="ODB_FELLES_SEQ", allocationSize=1)
@Column(name="A_ID")
private long id;
@OneToMany(mappedBy="A", fetch=FetchType.EAGER)
private Set<AX> setOfAX;
...
}
Code:
@Entity
@Table(name="AX")
public class AX
{
@Id
@ManyToOne
@JoinColumn(name="A_ID")
private A aAObj;
@Id
@ManyToOne
@JoinColumn(name="C_ID")
private C aCObj;
@Column(name="SOME_VALUE")
private long someValue;
...
}
Code:
@Entity
@Table(name="C")
public class C
{
@Id
@Column(name="C_ID")
private long cId;
@Column(name="ANOTHER_VALUE")
private long anotherValue;
...
}
during initialization I get the Mapping error:
Code:
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: domain.AX.A in domain.A.setOfB
all 3 classes are part of the annotedClasses property (using spring and annotationsessionfactory). If I remove the relation to AX from A (and removing AX from annotedclasses) it works ...
This is probably something simple I am doing wrong or misunderstanding, but I can't seem to wrap my head around what it is :)