-->
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.  [ 4 posts ] 
Author Message
 Post subject: Collections keep uninitialized when database returns 0 rows
PostPosted: Mon Jul 25, 2005 2:54 am 
Newbie

Joined: Thu Jul 21, 2005 3:02 am
Posts: 11
When doing the following

session.CreateQuery("from ObjA oa left join fetch oa.CollectionC cc where cc.Id in (200,201) and oa=:object").SetEntity("object", ObjAInst ).List();


CollectionC keeps uninitialized when no rows are returned from the database. I would expect the collection to be initialized with a length of 0.

It makes it a little hard to "be sure" that the collections is actually initialized..

Can this be confirmed??
Is there anyway in which you can initialize CollectionC with an empty array - when such a situation occurs..

Regards Morten


Top
 Profile  
 
 Post subject: Re: Collections keep uninitialized when database returns 0 r
PostPosted: Sat Sep 03, 2005 6:22 pm 
Newbie

Joined: Mon Jun 27, 2005 12:06 am
Posts: 18
Location: San Francisco, CA
str_mov wrote:
When doing the following

session.CreateQuery("from ObjA oa left join fetch oa.CollectionC cc where cc.Id in (200,201) and oa=:object").SetEntity("object", ObjAInst ).List();


CollectionC keeps uninitialized when no rows are returned from the database. I would expect the collection to be initialized with a length of 0.

It makes it a little hard to "be sure" that the collections is actually initialized..

Can this be confirmed??
Is there anyway in which you can initialize CollectionC with an empty array - when such a situation occurs..

Regards Morten


This happened to me too. My problem was, sometimes I was not expecting a LazyInitializationException. Also, catching that exception is a performance penalty too.

I don't think it's a hard fix in NHibernate though.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 10:26 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Looks like a bug, I'm bookmarking it to look at it later. Meanwhile, a JIRA issue with a simple test case would help a lot ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 5:42 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
I tried reproducing this and couldn't. It's possible that this bug was already fixed in CVS by some other change. Again, a test case would help a lot...


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