View Single Post
  #1 (permalink)  
Old 05-07-2008, 05:01 PM
ibjava ibjava is offline
Member
 
Join Date: May 2008
Posts: 3
ibjava is on a distinguished road
How to get object from composite-id in Hibernate?
Hi all, im new here, and newbie in java also

I usually get an object using id, which that id as the only PK, just like this:
Deposito deposito = dao.getDeposito(depositoId);

but now my Deposito doesn't allow to have id field, and have multiple PKs, here's the hbm code snipplet:
<composite-id>
<key-many-to-one name="dimTime" column="TIME_KEY"/>
<key-many-to-one name="dimLocation" column="LOCATION_KEY"/>
<key-property name="accountNumber" column="ACCOUNT_NUMBER" length="7"/>
</composite-id>

my question is:
How to get object that have composite-id in Hibernate?

actually i want to ask this question in this thread, I got it from google search, but im affraid it's gonna be OOT.

so, please help me & thanx b4!!
Reply With Quote
Sponsored Links