-->
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: findByExample foreign-key problem
PostPosted: Thu Dec 06, 2007 12:41 pm 
Newbie

Joined: Thu Dec 06, 2007 12:06 pm
Posts: 1
Hi, i run into the following problem with hibernate 3.2 :

i have an set of employees belonging to an department and try to get one of the employees by findByExample()

<class name="Deptartment">
...
<set name="employees">
<key column="deptId" not-null="true"/>
<one-to-many class="Employee" />
</set>
...
</class>

<class name="Employee">
...
</class>

hibnernate findByExample() will include a foreign-key column 'deptId' into the generated sql-query, BUT ONLY if the key-column is set 'not-null=true'. Else it will ignore the column like expected.

Of course this won't work cause there is no 'deptId' property in Employee.

Is there any way keeping hibernate from including that foreign-key-column into the query, or am i missing something fundamental here?


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.