-->
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.  [ 9 posts ] 
Author Message
 Post subject: Hibernate3 lazy initalization & J2EE good practice !!!!!
PostPosted: Wed Jun 15, 2005 6:28 am 
Newbie

Joined: Wed Jun 15, 2005 6:01 am
Posts: 3
Hi,
I've just migrated my app to Hibernate3. The surprise was that all the good design I've been trying to keep using Hibernate2 seems to be gone.

Logically, and as said in chapter 20, it is not a good practice to lazy- initalize our objects because eveytime we do that , we end up fetching up the entire model. In my applicaction I invoke the business logic using one Session Bean, close Hibernate session, get my Entity Bean and the whole process seems to clean and tidy. Now - using Hibenate3, I have to go back and close the session or, as said in Chapter3, I need some kind of Servlet filter to take care of Hibernate session.

Faisal
UK,B'ham


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 7:11 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You are very confused.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 9:00 am 
Newbie

Joined: Wed Jun 15, 2005 6:01 am
Posts: 3
That is true... since I've started using Hibernate3


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 9:28 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
So, if you are unable to read the Migration Guide (and that much is clear from your confusion about lazy loading), stick to Hibernate 2.


Top
 Profile  
 
 Post subject: It's mispelling thank you
PostPosted: Wed Jun 15, 2005 11:29 am 
Newbie

Joined: Wed Jun 15, 2005 6:01 am
Posts: 3
It's mispelling ...not confusion - non-initalized instead of initalized

The question is not mainly on how lazy initalization work in Hibernate3 . My main point is that in Hibernate3 I am no longer allowed to seperate the business logic from the web tier using a session bean . Do I have to send the live session back to close it? or do I have to use Servlet filter to deal with that. None of these should work. "a servlet filter can be used ...
We recommend that a ThreadLocal " as the documentation suggest is ...nonsense ... these work when I am invoking a single action.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 11:34 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Nothing changed between H2 and H3. You are making up excuses.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 11:42 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Ok, since you will probably post another load of nonsense, here is the deal: Step away from the computer and write down an explanation of your problem that is understandable to other people. If you don't know enough English, use your native language and find someone to translate it for you. But please don't post anymore.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 4:56 pm 
Beginner
Beginner

Joined: Thu May 26, 2005 12:31 pm
Posts: 25
I'm new to Hibernate. Still with the experience of doing a few code samples what I understood is...

If you are using lazy initialization,

Objects can not be INITIALIZED out side the scope of session, but once initialized objects can be accessed out side the scope of session.


This is same in H2 and H3.

Please correct me if I'm wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 5:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
totally correct soorajam.

And jukcoder, I assume you *did* notice that H3 now has lazy as default opposed to H3 (as documented in the english migration guide).

so, the semantics have *not* changed between H2 and H3 - but some of the default values for configuration parameters has.

_________________
Max
Don't forget to rate


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