-->
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: Criteria Query and Opposite Side of Many-to-One Relationship
PostPosted: Wed Dec 15, 2004 5:49 pm 
Beginner
Beginner

Joined: Mon Nov 22, 2004 8:53 pm
Posts: 23
I have 2 tables and objects: Car and User

Car table:
car_id
update_user_id

User table:
user_id

So I have them mapped as follows:

<class name="Car" table="Car">
<id name="id" column="car_id">..</id>
<many-to-one name="updateUser" class="User" column="update_user_id"/>
</class>

<class name="User" table="User">
<id name="id" column="user_id">..</id>
</class>

I'm wondering how to construct a Criteria Query for getting all of the users that have been assigned as an updateUser for Car.
The SQL would be select user_id from User, Car where update_user_id = user_id. How do I construct the Criteria Query?

Thanks!

Hibernate version:2.1.6


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.