-->
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: Loading a class with a composite key without PK class
PostPosted: Sat Jul 17, 2004 6:47 am 
Newbie

Joined: Sat Jul 17, 2004 6:39 am
Posts: 7
Hi,

I have an object with the following key:

<composite-id>
<key-property name="id" type="string" column="id" length="15"/>
<key-many-to-one name="group" class="Group" column="group_id"/>
</composite-id>

I want to be able to do the equivalent of

session.load(MyClass.class, id, groupInstance)

, but I don't want to declare a PK class. As I understand, my alternatives are

1) declare a PK class
2) use a query to load the object

Are these the only alternatives?

Thanks,
G


Top
 Profile  
 
 Post subject: Re: Loading a class with a composite key without PK class
PostPosted: Sun Jul 18, 2004 11:24 am 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
Can't you query by example where you set the key and group? Or query with criteria and set the key as the Java type (not create a POJO for it). Maybe Im missing something here. Chris


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 18, 2004 11:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You can use an instance of the class as the "identifier". Hibernate will load the state into the instance you provide.


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.