Hibernate version:
2.1.6
Is there any way of totally disabling lazy nested objects and just keeping them in the mapping file for doing the joins for you in the queries and explicitly fetching objects?
The reason is sometimes I have objects like this...
Code:
<class name="ElementConnection" table="element_connection" lazy="true" >
<id name="EctId" type="int" column="ect_id" unsaved-value="null" >
<generator class="assigned" />
</id>
<version name="VersionId" column="ect_version_id" type="int" />
<property name="BndId" column="bnd_id" type="int" not-null="true" />
<property name="EctFromEltId" column="ect_from_elt_id" type="int" not-null="false" />
<property name="EctToEltId" column="ect_to_elt_id" type="int" not-null="true" />
<many-to-one name="FromElement" class="Element" column="ect_from_elt_id" update="false" insert="false" />
<many-to-one name="ToElement" class="Element" column="ect_to_elt_id" update="false" insert="false" />
<many-to-one name="Band" class="Band" column="bnd_id" update="false" insert="false" />
</class>
But for various reasons I NEVER use the many-to-one nested objects in an object model way ( get/set ) but it is very nice to use them in queries for easy joining to other tables. And what I would like is when a ElementConnection object is retrieved for the lazy nested objects not to have a proxy created.
The reason is doing this:
Code:
session.find( "from ElementConnection" )
takes roughtly 50% longer ( 28 vs 43 seconds for 500k objects ) and consumes more memory ( although not much ) when the nested objects are present presumably because of the time required to create the proxy objects.
I don't think this is possible right now but I just thought I would check and see what anyone thought.