-->
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.  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Tue Dec 12, 2006 4:34 am 
Beginner
Beginner

Joined: Mon Nov 20, 2006 9:06 am
Posts: 29
Lester,

One small problem comes up, related to this one.

As you can imagine, I call the function, desribed in the previous psot from a testfile.
All works fine now, except

If I remove the System.out.println(ret.get(0).toString());

Than the old error comes back
(org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed)

Even when I put a
Hibernate.initialize((Archetyped) ret.get(0));
instead, it makes no difference.

Do you have any idea?

For testing purposes, I can proceed with working, but I do not like code which I don't understand


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 12, 2006 6:30 am 
Regular
Regular

Joined: Wed Mar 23, 2005 8:43 am
Posts: 105
Location: Moscow, Russia
Yes, that's right! When you call System.out.println(ret.get(0).toString()) inside doInHibernate(Session session) and, respectivly, inside session you initialize ArctypeID property-proxy (you must see additional select in console or log). To make this work without this line, you must call Hibernate.initialize(((Archetyped) ret.get(0)).getArctypeID()), not Hibernate.initialize((Archetyped) ret.get(0)), inside doInHibernate(Session session) method because you want to initialize property(proxy) of the Arctyped object, not the Arctyped object itself. Or you can use HQL query with left join fetch as i write before.

_________________
Best Regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 12, 2006 8:14 am 
Beginner
Beginner

Joined: Mon Nov 20, 2006 9:06 am
Posts: 29
Thanks, Lester, you have been a great help

regards
Bert Verhees


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 18 posts ]  Go to page Previous  1, 2

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.