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
|