-->
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.  [ 3 posts ] 
Author Message
 Post subject: Detecting when a collection has been initialized via lazy in
PostPosted: Wed May 18, 2005 9:49 pm 
Newbie

Joined: Sun Oct 31, 2004 3:22 pm
Posts: 6
Hibernate version:2.1

Mapping documents: <na>

Code between sessionFactory.openSession() and session.close(): <not applicable>

Full stack trace of any exception that occurs: <not applicable>

Name and version of the database you are using:<not applicable>

The generated SQL (show_sql=true):<not applicable>

Debug level Hibernate log excerpt:<not applicable>

Lazy Initialization is working well for us. My question is: How do I detect whether a collection has been initialized? I have tried several different ways to check, but it seems that any attempt to discover the information results in the colllection being initialized.

This is causing a bit of an issue when I attempt to perform additional "cleanup" work to prepare objects for garbage-collection. We have a standard operation named "shutdown()". This operation is responsible for the task of "shutting down" its children and then shutting down itself. If a collection of "children" has not been initialized, previously, I don't want to initialize it in the shutdown operation.

Does anyone have any suggestions on this?

Thanks in advance,
Gerry


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 1:34 pm 
Regular
Regular

Joined: Tue May 24, 2005 10:19 am
Posts: 65
try Hibernate.isInitialized()
see :http://www.hibernate.org/hib_docs/api/net/sf/hibernate/Hibernate.html#isInitialized(java.lang.Object)[/url]


Top
 Profile  
 
 Post subject: Detecting when a collection has been initialized via lazy
PostPosted: Sun Jul 03, 2005 11:31 am 
Newbie

Joined: Sun Oct 31, 2004 3:22 pm
Posts: 6
Thanks, I'll give that a try.

Gerry


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.