-->
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: lazy loading for many-to-one relations with "property-r
PostPosted: Thu Aug 18, 2005 9:37 am 
Newbie

Joined: Thu Aug 18, 2005 2:51 am
Posts: 1
In our (example-)mapping (Child.hbm.xml) we have a many-to-one reference to an other object (Parent) using the property-ref attribute. The problem is, that the referenced object is loaded with it.

In our business application we have a huge chain of many-to-one references between the tables using the "property-ref" attribute, which leads to "OutOfMemory" exception when we are trying to load just one object, since lazy-loading is not fully implemented for this case.

What we would urgently need is lazy loading for many-to-one relations with "property-ref" attributes.

Is there a chance to have this functionality in the final 3.1 version?

Hibernate version: 3.1b2

Mapping documents:
<!-- Child.hbm.xml -->
<hibernate-mapping>
<class name="nts.infrastructure.dataprovider.Child" table="CHILD">
<id name="gidc" column="GIDC">
<generator class="increment" />
</id>
<property name="name" column="NAME" />
<property name="xc" column="XC" />
<property name="yc" column="YC" />
<many-to-one name="parent" class="nts.infrastructure.dataprovider.Parent" unique="true" property-ref="parent_key" insert="false" update="false" lazy="proxy">
<column name="xc"/>
<column name="yc"/>
</many-to-one>
</class>
</hibernate-mapping>

<!-- Parent.hbm.xml -->
<hibernate-mapping>
<class name="nts.infrastructure.dataprovider.Parent" table="PARENT">
<id name="gidp" column="GIDP">
<generator class="increment" />
</id>
<property name="name" column="NAME" />
<property name="xp" column="XP" />
<property name="yp" column="YP" />
<properties name="parent_key" unique="true" update="false">
<property name="xp" column="XP" insert="false" update = "false"/>
<property name="yp" column="YP" insert="false" update = "false"/>
</properties>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Query q = session.createQuery("from Child");
List res = q.list();
for (Iterator it = res.iterator(); it.hasNext();) {
Child c = (Child) it.next();
Parent parent = c.getParent();
}

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Oracle 10g

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


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.