-->
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: Merge or re attach problem
PostPosted: Tue Oct 10, 2006 8:46 am 
Newbie

Joined: Thu Aug 03, 2006 8:30 am
Posts: 4
Hibernate version: 3.1.2

Hi Everyone,

My problem is the following:
I'm working on a 3 tier application. I use services that I developped to persit data. I've got a problem with entity A that I load, modify and then merge.
The merge return a detached object and my hibernate session is closed.
Before the merge I can acces B data from A.
So when I want to acces the entity B related object of A after the merge, I' ve got the following message/error:
ERROR LazyInitializationException:19 - could not initialize proxy - the owning Session was closed
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:56)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158)
at B$$EnhancerByCGLIB$$fa2fcb9e_4.toString(<generated>)
at java.lang.String.valueOf(Unknown Source)
at java.lang.StringBuilder.append(Unknown Source)


The link between A and B is a unidrectionnal one to one link mapped like this (on FK):
A.hbm.xml
Code:
<many-to-one name="B" entity-name="B" column="B_ID" unique="true"/>



How can I do to have B data linked after the merge on A?

I tried one-to-one link between A and B but I don't want to load B when I'm loading A (that one-to-one do, I didn't find anything to load lazily on a one-to-one)?

Realy need some help on this, searched a lot, found nothing.
Please.


Vision


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.