-->
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: Thanks for an excellent book - question re DB connections
PostPosted: Thu Jul 19, 2007 5:15 pm 
Newbie

Joined: Tue Jul 17, 2007 3:52 pm
Posts: 3
Hi,

I am new to Hibernate and getting back into JEE coding after 4 years away travelling and studying. I am really happy that a framework like Hibernate exists to do all the stuff I had to myself and much much more. Thankfully there will be no more objects that resemble database rows rather than a proper domain structure in my projects!

Also, thanks for writing a great book. It really is one of the best and clearest java books I have read, and it was easy to get into Hibernate despite being new to ORM.

I have a question: the section on OpenSessionInViewFiler mentioned that we should not use this filter on pages that do not require database access. Even though I am not using this filter and controlling Hibernate from my service layer this made me wonder… I know that for a given request I will only be reading reference data from the second level cache. In that scenario I need a hibernate session but I don’t want any contact with the database (connections acquired etc.) For pages where I only need reference data which is definitely in the cache, can I safely drop the transaction code to make sure no connections are acquired? (I am assuming beginTransaction() is where a database connection is first acquired)

Any help would be much appreciated, and thanks for the good work,

Jim


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 28, 2007 3:25 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This is an interesting question. If you don't begin a transaction and if no SQL is ever executed against the database, the Session should not aquire a connection. Not sure though, enable debug logging and try the seclevel cache.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.