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 Going crazy.. can't join on this compound key class and not sure why? 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 "Going crazy.. can Watch "Going crazy.. can New topic
Author

Going crazy.. can't join on this compound key class and not sure why?

Brick Riccardi
Greenhorn

Joined: Jun 01, 2008
Posts: 22
I have a compound Primary Key and I created an object to represent that Primary Key. What I'm curious about is how I can join on a member property of that primary key object if I so desire.

For example this named query is not working:

select ap from AssociatePreference ap, Associate ass where ass.associateID = ap.pk.associateID and ass.dmzID = :dmzID

The error:



I'm not sure why I can't query on that kind of join, there should be a way since it's so darn simple in sql. I understand I can actually get the AssociatePreference List by going after the Associate record - that'll work fine - however there 'should' be a way I can just get AssociatePreferene objects trying a join in some way without caring about the entire Associate.

I've posted relevant portions of code below:



edited bc forgot to disable smilies
[ October 27, 2008: Message edited by: Brick Riccardi ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Going crazy.. can't join on this compound key class and not sure why?
 
Similar Threads
selectManyListbox value attribute
Mysql auto generated PK used for another table and JPA
Identity issue for EJB3.0 Entity along with Hibernate HBM configuration
Problem with OUTER JOIN hibernate
Could not determine type for: java.util.Set