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: Problem saving lazy collection
PostPosted: Tue Oct 10, 2006 5:11 am 
Beginner
Beginner

Joined: Mon May 22, 2006 12:12 am
Posts: 23
Dear All,


Previously, I had problem retrieving lazy collections. With some advice, I barely managed it.

But then, I still lack the knowledge to make it work for updating. My case:

Document class is self-referencing; it has a set named parentDocs (i.e. parent documents) and set to lazy. The value of parentDocs is saved in a table named DocInDocuments.

I received error (no session to fetch lazy collection) on running the following line of code simply adding a parent document (docParent) to the parentDocs collection of the child document (doc):
doc.parentDocs.Add(docParent);

your insight is much appreciated.

best regards,
jack Ling


Top
 Profile  
 
 Post subject: Re: Problem saving lazy collection
PostPosted: Tue Oct 10, 2006 5:29 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
fly2moon2 wrote:
Document class is self-referencing; it has a set named parentDocs (i.e. parent documents) and set to lazy. The value of parentDocs is saved in a table named DocInDocuments.

I received error (no session to fetch lazy collection) on running the following line of code simply adding a parent document (docParent) to the parentDocs collection of the child document (doc):
doc.parentDocs.Add(docParent);

So, is the session present for fetching? In case of set, the content of collection must be fetched before adding an element, cause the set may not contain duplicates.

Read 14.1.2 and 14.1.3 (and probably all others :D) from http://www.hibernate.org/hib_docs/nhibernate/html/performance.html#performance-collections

Gert

_________________
If a reply helps You, rate it!


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.