Bottom-line question (in case you don't want to wade through all the exposition): When the Annotations documentation says "You cannot mix configuration strategies (hbm vs annotations) in a mapped entity hierarchy", does "hierarchy" include associations, such as a ManyToMany, or just inheritence, which is what I intuitively think of? I would appreciate any clarification, as I could then stop looking for elusive typos that could be causing my problem described below.
Hibernate version: 3.1.2 (annotations - 3.1beta8)
Full stack trace of any exception that occurs:Could not determine type for: com.dynedge.model.Person, for columns: [org.hibernate.mapping.Column(elt)]
I have a Person class, mapped with an hbm.xml file.
I have an annotated Group class.
I'm trying to establish a many-to-many relationship between Person and Group via a GroupMembership join-table.
I'm getting the exception above. It's vague to me; I don't understand what "elt" is telling me. But I've narrowed it down to the following inside my Group class:
Code:
@ManyToMany(targetEntity=Person.class, fetch=FetchType.LAZY)//, mappedBy="groups")
@JoinTable(name="GroupMembership",
joinColumns={@JoinColumn(name="personId", nullable=false)},
inverseJoinColumns={@JoinColumn(name="groupId", nullable=false)})
@OrderBy(value="lastName ASC")
public List<Person> getMembers() {
return members;
}
(if I uncomment the mappedBy parameter, then
that part throws an exception indicating the same problem: org.hibernate.AnnotationException: "Collection of elements must not have mappedBy or association reference an unmapped entity: com.dynedge.model.Group.members"
Both Person and Group map fine if I comment out the relationship between the two.
Thanks!
Jim