-->
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: default-lazy="false" caused an infinite loop
PostPosted: Mon May 02, 2005 11:55 am 
Newbie

Joined: Wed Oct 29, 2003 1:29 am
Posts: 5
Hibernate version:

3.02

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false">
<class name="software.translationtools.tpms.localadministration.PersonImpl" table="TPERSON" dynamic-insert="true" dynamic-update="true" polymorphism="explicit">
<composite-id name="key" class="software.translationtools.tpms.KeyImpl">
<key-property name="id" column="id"/>
<key-property name="orgId" column="orgId"/>
</composite-id>

<property name="personId" column="personId" />
<property name="tpmsUserId" column="tpmsUserId" />
<property name="lastName" column="lastName" not-null="true"/>
<property name="firstName" column="firstName" not-null="true"/>
<property name="street" column="street" />
<property name="cityArea" column="cityArea" />

<many-to-one name="organization" class="software.translationtools.tpms.fixedvalues.Organization" insert="false" update="false" fetch="join">
<column name="ORGID" />
</many-to-one>

<many-to-one name="employmentType" column="FFEMPLOYMENTTYPE" class="software.translationtools.tpms.fixedvalues.EmploymentType" fetch="join"/>

<many-to-one name="lineManager" class="software.translationtools.tpms.localadministration.PersonImpl" fetch="join">
<column name="FLINEMANAGERID" />
<column name="FLINEMANAGERORGID" />
</many-to-one>


</class>
</hibernate-mapping>

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

<class name="software.translationtools.tpms.projectmanagement.shipments.ShipmentImpl" table="TLSHIPMENT" >

<composite-id name="key" class="software.translationtools.tpms.KeyImpl">
<key-property name="id" column="id" type="integer" />
<key-property name="orgId" column="orgId" type="string"/>
</composite-id>

<property name="name" column="SHIPMENTNAME" />
<property name="shipmentId" column="SHIPMENTID" />
<property name="plannedDevelopmentDeliveryDate" column="LABPLANNEDDATESHP" />
<property name="actualDevelopmentDeliveryDate" column="LABACTUALDATESHP" />
<property name="plannedShippingToTscDate" column="PLANNEDDELIVERDATE" />
<property name="actualShippingToTscDate" column="ACTUALDELIVERDATE" />

<many-to-one name="shipmentMethod" column="FFSHIPMENTMETHOD" class="software.translationtools.tpms.fixedvalues.ShipmentMethod" fetch="join"/>
<many-to-one name="shipmentIuc" column="FFIUCATEGORY" class="software.translationtools.tpms.fixedvalues.InfoUnitCategory" fetch="join"/>

<many-to-one name="owner" class="software.translationtools.tpms.localadministration.PersonImpl" update="false" insert="false" lazy="true">
<column name="FLOWNERID" />
<column name="ORGID" />
</many-to-one>

<!-- work around for to save the owner id -->
<property name="ownerId" column="FLOWNERID" />

</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

List list = session.createQuery("from ShipmentImpl where " + str).list();

Full stack trace of any exception that occurs:

infinit loop trying to load a person and the person's line manager (both are the same person).

No exceptions are thrown.

Name and version of the database you are using:

DB2 8.1.5


Notes:
-------

(1) we have huge mapping files ... These are just part of the files that would indicate the problem.

(2) The code example that I provided is also not the exact test code that I used, because the code is complicated and includes a lot of mapped classes.

I have already identified the problem. I have removed the default-lazy="false" from the PersonImpl mapping and used the lazy="true" on the mapped elements instead and it worked perfectly.

do u think that this is a problem worth opening a tracking issue for ?[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 02, 2005 1:50 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
I have already identified the problem. I have removed the default-lazy="false" from the PersonImpl mapping and used the lazy="true" on the mapped elements instead and it worked perfectly.


whas when you hit the lazy property? infinite loop?. check your get/set pair

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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.