-->
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.  [ 1 post ] 
Author Message
 Post subject: Associations without recreating entire object?
PostPosted: Fri Dec 16, 2005 8:04 pm 
Newbie

Joined: Wed Nov 02, 2005 4:48 pm
Posts: 4
Hi,

Is it possible to have an association between entity objects such that when I read that association back out of the database it will provide me with just the identifier of an entity object on the end of an association rather than the whole entity object? i.e. in the mapping below, when I get Activity's flow property it will be a Flow object, and when I get Flow's activities property in will be List<Activity>. What I would prefer is that those two properties return an Integer, and List<Integer> (since we use Integers for IDs). Is it possible to do that somehow?

In our system, Objects refer to eachother by way of an ID rather than a direct Java reference, so having Hibernate create a bunch of entity objects when reading the associations from the DB is wasteful.

Thanks!

Hibernate version:
3.0.5

Mapping documents:
<joined-subclass
name="Activity"
extends="Task"
table="ACTIVITIES" lazy="false">
<key column="ACTIVITY_ID"/>

<many-to-one name="flow" column="FLOW_ID"
class="Flow"
access="ElementReferenceAccessor"/>
</joined-subclass>

<joined-subclass name="Flow"
extends="Task"
table="FLOWS" lazy="false">
<key column="FLOW_ID"/>

<bag name="activities" inverse="true" lazy="false"
access="ElementReferenceListAccessor">
<key column="FLOW_ID"/>
<one-to-many
class="Activity"/>
</bag>
</joined-subclass>

Name and version of the database you are using:
HSQL 1.8


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

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.