-->
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 across two HTTP service request
PostPosted: Fri Sep 09, 2011 6:11 am 
Newbie

Joined: Fri Sep 09, 2011 5:34 am
Posts: 1
Hi,

I am new to hibernate. I am developing a flex application with java on the server side. I have a parent-child relation ship in my application domain objects. It is a wizard based UI where I'll bring all parents as a list on the first page (This happens in one HTTP service request aka BalzeDS service). Depending on the selection of a parent by the user (on clicking a parent), I would like to bring all children of the selected parent in a second HTTP service request. I am using lazy loading from parent to child. I am getting the following exception.

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.sas.analytics.mfg.pam.domain.DataSelectionDefinition.dataSelectionSubjects, no session or session was closed


Following is my domain relationship.

<hibernate-mapping>
<class name="test.parent" table="parent_table">
<id name="id">
<column name="ID" />
<generator class="native"/>
</id>
.
.
.
<set name="childrenObjects" table="child_table" fetch="select" cascade="all-delete-orphan" inverse="true">
<key>
<column name="ID" not-null="true" />
</key>
<one-to-many class="test.child"/>
</set>
.
.
.
</class>
</hibernate-mapping>



<hibernate-mapping>
<class name="test.child" table="child_table">
<id name="id">
<column name="CHILD_ID" />
<generator class="native"/>
</id>

<many-to-one name="parentDefinition" class="test.parent" fetch="select">
<column name="PARENT_ID" not-null="true" />
</many-to-one>
.
.
</class>
</hibernate-mapping>


My question is how can we use lazy loading for a one-to-many relation across two HTTP servcie request where the parents get populated in one view(on first HTTP service request) and depending on the selection of an entry in the parent view an application loads the children on to a second view (in second HTTP service request).


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.