-->
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.  [ 2 posts ] 
Author Message
 Post subject: session.load(Class, compositeKey)
PostPosted: Wed Nov 05, 2003 12:27 pm 
Beginner
Beginner

Joined: Mon Sep 01, 2003 10:52 am
Posts: 23
Location: UK
Is it possible to use the session.load(class, id) with a composite key?

I have several classes that I have implemented using composite keys such as the following class

public class ASControlSection {

private ASControlSectionCompositeKey ascskey = null;
private String asControlSectionDesc =null;

}

public class ASControlSectionCompositeKey implements Serializable{

private String asStationCode =null;
private String asAllocationCode =null;
private String asControlSectionCode =null;

}

The mapping xml is

hibernate-mapping>
<class name="uk.co.customerinteraction.dao.ASControlSection" table="LTRAPF.TKDYREP">
<composite-id name="ascskey" class="uk.co.customerinteraction.dao.ASControlSectionCompositeKey">
<key-property name="asAllocationCode" column="DYSEC2"/>
<key-property name="asControlSectionCode" column="DYSGC2"/>
<key-property name="asStationCode" column="DYSCC2"/>
</composite-id>
<property name="asControlSectionDesc" column="DYK3NA"/>
</class>
</hibernate-mapping>

At the moment I am using a hibernate Query to retreive the object, but was wondering if I would be better using the session.load(class, id).

If it is possible which is more efficient, the query on the primary key or the session.load?

thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 05, 2003 7:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Sure, of course you can use it! Thats the whole reason for the composite id class!

load() is supposed to be more efficient than find().


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.