This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Incorrect joins on composite ID Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Incorrect joins on composite ID" Watch "Incorrect joins on composite ID" New topic

Incorrect joins on composite ID

Vinnie Jenks
Ranch Hand

Joined: Apr 26, 2004
Posts: 207
I've got a simple parent/child relationship between two tables/objects but both tables have composite IDs. I'm able to query them but the joins are not correct.

Here are the details...

parent mapping:

child mapping:

The query that is returned:

Notice the join's not joining the correct fields...I would have expected this query:

Even though I specified the key fields to join's using the primary key(s) from the parent mapping (or so it appears.)

What am I doing wrong?


Hibernate version: 3.1

Name and version of the database you are using: MSSQL 2000
mysha ahamed

Joined: Aug 03, 2005
Posts: 22
Did u solve this problem...I also want to join on specific keys,instead hibernate joins on only primary keys..
wood burning stoves
subject: Incorrect joins on composite ID
Similar Threads
Hibernate generating queries with duplicate columns
Hibernate and a Table called [group] - problem
Hibernate: Different Join in Save() and Get()
Can't map child List w/ composite ID
hbm without primary key