-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Clarification on mixing hbm.xml-mapped and annotated classes
PostPosted: Sat Feb 04, 2006 2:01 am 
Newbie

Joined: Thu Jul 14, 2005 5:39 pm
Posts: 12
Location: Ann Arbor, MI
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 2:06 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
http://opensource.atlassian.com/projects/hibernate/browse/ANN-236

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.