-->
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: net.sf.hibernate.collection.Set and java.util.Set
PostPosted: Thu May 06, 2004 1:07 pm 
Newbie

Joined: Mon Jan 12, 2004 10:06 am
Posts: 15
Hi all.

We are making one web application with Struts and Hibernate. When I load an element (with some relations inside it) I have one object with some relations mapped inside Set objects (java.util.Set interface and net.sf.hibernate.collection.Set implementation). Supose that we have those objects inside Set lazy (so they will be loaded if they are readed).
Ok. We want to transfer our persistent objects to Front (Web) objects (to make layer separation), maybe Struts Forms. Is there a way to convert my persistent Set (from Hibernate) to java.util.Set (with no reference to hibernate Session) without making load of all objects? I mean, when I do something inside my persistent object, hibernate start to load them and I only want one new java.util.Set without making lazy loading.

Any idea? Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 6:17 pm 
Regular
Regular

Joined: Tue Nov 11, 2003 7:35 pm
Posts: 63
I'm not clear why you would need to convert it. If you do not want the objects lazy loaded, dont call those methods in your objects to cause lazy loading! If you want an object or collection loaded in advance, call Hibernate.initialize() on that object or collection.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 07, 2004 5:51 am 
Newbie

Joined: Mon Jan 12, 2004 10:06 am
Posts: 15
Hi again.

If I convert from hibernate objects to actionform objects, maybe with BeanUtils.copyProperties(), Set objects are translated from hibernate to actionForms but they are still conected to Hibernate. If I, for example, set log to debug with Struts (which means that struts sends a message to logger with the contents of the ActionStruts) then hibernate starts to make queries. I mean, I dont ask for those objects because I dont want to read them (this is the reason I make the Set lazy). For that reason I'm asking if is there a way to separate objects from hibernate from objects of the view side to make separation between layers without making hibernate to call all lazy objects.

Any idea? Thanks a lot


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.