Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:50:28+00:00 2026-05-30T00:50:28+00:00

I just followed a simple hibernate struts tutorial and succesfully made db calls through

  • 0

I just followed a simple hibernate struts tutorial and succesfully made db calls through hibernate. However I don’t see the code closing the hibernate connection anywhere.

sessionFactory.getCurrentSession();

is used to get the session per request. Should I close this session when the user logs out? or after each request of is this something taken care of by the framework?

a second related question is, In what kind of use case would I use a hibernate session interceptor?

and a third question(sorry it just popped in my mind) what the best option for caching with hibernate/struts2?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:50:30+00:00Added an answer on May 30, 2026 at 12:50 am

    Regarding the first question, the reference documentation says:

    A org.hibernate.Session begins when the first call to
    getCurrentSession() is made for the current thread. It is then bound
    by Hibernate to the current thread. When the transaction ends, either
    through commit or rollback, Hibernate automatically unbinds the
    org.hibernate.Session from the thread and closes it for you.

    Regarding your second question, the documentation says:

    The Interceptor interface provides callbacks from the session to the
    application, allowing the application to inspect and/or manipulate
    properties of a persistent object before it is saved, updated, deleted
    or loaded. One possible use for this is to track auditing information.
    For example, the following Interceptor automatically sets the
    createTimestamp when an Auditable is created and updates the
    lastUpdateTimestamp property when an Auditable is updated.

    Regarding the third question, Struts2 is a presentation framework. It has nothing to do with persistence and thus caching of the persistent entities. The documentation talks in details about the second-level cache.

    As you see, the documentation has a whole lot of interesting information. I would advise reading it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just installed scrapy and followed their simple dmoz tutorial which works. I just
I've written a simple MVC3 application and followed a tutorial on how to set
I'm testing a simple checkout form using stripe for payments. I followed tutorial examples
I've just been following the tutorial on the CakePHP website to create a simple
EDIT: SOLVED I JUST HAD TO WAIT FOR AWHILE So I followed the simple
I don't know if this is correct - I just followed the example on
I followed the simple tutorial @ http://www.devart.com/dotconnect/oracle/articles/Tutorial_EF.html (Which works perfectly, btw) combined with http://www.hanselman.com/blog/CreatingAnODataAPIForStackOverflowIncludingXMLAndJSONIn30Minutes.aspx
I've followed the Google app script tutorial here which is a very simple script
I realized today that I have blindly just followed this requirement for years without
I have just meticulously followed MS instructions for customising a dynamic data page template

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.