-->
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.  [ 3 posts ] 
Author Message
 Post subject: HSQL with Composite Id Problem
PostPosted: Tue Feb 24, 2004 5:04 pm 
Beginner
Beginner

Joined: Tue Sep 09, 2003 5:28 pm
Posts: 33
Location: Cincinnati, OH
Hi all,

I am not sure if someone has asked this kind of question or not, but I just couldn't find the right answer.

The version of Hibernate I am using is Hibernate 2.1 final, and the database is IBM AS/400.

The table I am working on is called Alias, which has a composite primary key with three columns (firm, userid, alias). I created a AliasKey class to hold these three columns, and map it to hbm.xml file using <composite-id>, and everything works just fine. I can load the object using
Code:
AliasKey id = new AliasKey("ab", "cd", ef");
Alias a = session.load(Alias.class, id);


However, now I want to just give firm and userid these two columns to get the records, I don't know how to write the SQL statement to do it, anybody had the same problem before, and knew the solutions?

Thanks so much for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2004 5:34 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
from Alias alias where alias.id.firm = ?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2004 5:45 pm 
Beginner
Beginner

Joined: Tue Sep 09, 2003 5:28 pm
Posts: 33
Location: Cincinnati, OH
Thanks emmanuel so much for replying! I will try it!


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

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.