-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to disable Lazy initialization in the presentation layer
PostPosted: Tue Dec 09, 2003 7:08 pm 
Newbie

Joined: Tue Nov 18, 2003 1:00 pm
Posts: 6
Upon getting a composite value object in my presentation layer with a particular set of one-to-many mappings I would like to have the value object no longer attempt to lazily initialize a collection, but return null if not populated.

Is there a way to do this in Hibernate? Is there a disable method or a clone method? or do I have to write a method to clone my composite value object using Set (HashSet) instead of PersistentCollection.

Here's the scenario: a 3 tier application with the presentation layer being Struts, the business layer using Session EJBs, and Hibernate for ORM. Once a composite value object leaves the business layer I no longer want it to engage in a transaction (open/reconnect/close/disconnect from a Hibernate Session).

Thanks in advance, Dan


Top
 Profile  
 
 Post subject: Re: How to disable Lazy initialization in the presentation l
PostPosted: Wed Dec 10, 2003 10:40 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
drocklein wrote:
Is there a way to do this in Hibernate?
Is there a disable method or a clone method?

No,
No.

How can you reassociate the object graph if you do such a thing. Hibernate will guess you explicitly set your collection to null

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 10:44 am 
Newbie

Joined: Tue Nov 18, 2003 1:00 pm
Posts: 6
Is there a way to do a generic toString on the composite value object described without invoking the lazy instantiation?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 11:32 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Not wo hacking hibernate I suppose. Only equals, hashcode and id does not break the lazyness AFAIK

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 11:55 am 
Newbie

Joined: Tue Nov 18, 2003 1:00 pm
Posts: 6
Thanks for the help, Dan


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