-->
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: Result of binding SessionFactory to JNDI ?
PostPosted: Sun Aug 29, 2004 12:57 am 
Regular
Regular

Joined: Sat Aug 28, 2004 4:15 pm
Posts: 61
Hibernate version: 2.14

I am currently binding my session factory to JNDI using a Struts plugin. Then, I pull the SessionFactory out of context each time I need to open a session from the session factory.

My question is this: If I bind the SessionFactory to JNDI, don't I lose the benefits of the L2 cache because the only time the sessionfactory is bound to JNDI is when the application starts up?

It seems to me that I could rebind the session factory after each database access but that seems to negate the purpose.

Could someone please clarify this for me?

I have read many forum posts, Hibernate in Action(meap), Hibernate: A developers notebook, TFM.

I thank you for your insights.

Joe W

_________________
Joe W


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 29, 2004 2:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I don't follow your reasoning, but the answer is "no".


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 29, 2004 11:37 am 
Regular
Regular

Joined: Sat Aug 28, 2004 4:15 pm
Posts: 61
I was thinking that when binding the SessionFactory to JNDI, the session factory is serialized and sent to JNDI to store the object itself. Then, when the SessionFactory is pulled from JNDI it is deserialized and sent to the requester. This would mean that the sessionfactory would never change.

However, from your answer it appears as though JNDI simply holds a reference to the object and that is what the context lookup provides ( a reference to the object). So, all uses of the SessionFactory do in fact operate on the same SessionFactory.

_________________
Joe W


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.