-->
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.  [ 1 post ] 
Author Message
 Post subject: HQL does not work for related table in many-to-many relation
PostPosted: Thu Apr 11, 2013 9:20 am 
Newbie

Joined: Thu Apr 11, 2013 9:09 am
Posts: 2
Hello...

I have found something strange.

I am using NetBeans Hibernate plugin to configure the connection to my database.

I have one related table with many-to-many relation.

When I finished the wizard, XML mapping for the parent table contains this:

Code:
            <many-to-many entity-name="agenda.Subscripcion">
                <column name="SUBID" not-null="true" />
            </many-to-many>


That way, when I run a query in HQL editor, I get this error:
org.hibernate.MappingException: An association from the table subscripcionescliente refers to an unmapped class: agenda.Subscripcion

when I change entity-name attribute, in order to be class attribute:

Code:
            <many-to-many class="agenda.Subscripcion">
                <column name="SUBID" not-null="true" />
            </many-to-many>


it works.

Can you clarify me this point, please? Why did the wizard generate the incorrect attribute? Or maybe I have solved this specific problem but I could find another problem later when trying to use the relationship.

Cheers
Jaime


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

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.