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
|