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: Testing if a child collection has been initialised ?
PostPosted: Mon Oct 22, 2007 6:31 am 
Beginner
Beginner

Joined: Tue Jun 06, 2006 4:47 am
Posts: 25
I have a lazy loaded child collection in one of my business objects, and I need to test to see if nHibernate has populated the collection yet.

I need to be able to run the check without nHibernate actually populating the collection.

Many thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 23, 2007 5:43 am 
Beginner
Beginner

Joined: Tue Jun 06, 2006 4:47 am
Posts: 25
I think I found the way.

Code:
AbstractPersistentCollection lst = (AbstractPersistentCollection)collectionname.Value;
if (lst.WasInitialized)......


Cast your collection back to AbstractPersistentCollection and check the WasInitialized property.

it seems to work for me.


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.