Hibernate version: 3.1
Hibernate-annotations version: 3.1beta7
Mapping documents: EJB+Hibernate annotations
Dears,
don't know if it is because I'm not supposed to do it, but the following stuff:
Code:
@EmbeddableSuperclass(access = AccessType.FIELD)
public class A_PK implements Serializable {
@ManyToOne
@JoinColumn(name = "idB")
@NotNull
public B b;
@ManyToOne
@JoinColumn(name = "idC")
@NotNull
public C c;
...
}
@Entity(access = AccessType.FIELD)
@Table(name = "A")
@IdClass(A_PK.class)
public class A extends A_PK {
@Column(length = 16)
@NotNull
public String someText;
...
}
@Entity(access = AccessType.FIELD)
@Table(name = "B")
public class B {
@Id
public Integer id;
@OneToMany(mappedBy = "b")
public Collection<A> as;
...
}
@Entity(access = AccessType.FIELD)
@Table(name = "C")
public class C {
@Id
public Integer id;
@OneToMany(mappedBy = "c")
public Collection<A> as;
...
}
causes an:
Quote:
org.hibernate.MappingException: property not found: c on entity A
This happens during the Collection Mapping phase ("processing collection mappings). More precisely, during the:
Quote:
Mapping collection: C.as -> A
I didn't find anything like this in the test cases of my hibernate-annotations.jar and both the ejb-3.0 and hibernate-annotations specs are a bit scarce of hints about how to mimic the old <key-many-to-one> construct with annotations. Also, the kind of error seems to be related to a problem with the @EmbeddableSuperclass thing.
Am I wrong (once more), or the above-shown class setup is supposed to work with hibernate-annotations, maybe sometime in the future?
Regards,