Search code examples
javahibernatejsptransactionssession-per-request

Hibernate and JSP Transaction per Request


Hey, I'm building a four tier software system (Presentation - JSP, Problem Domain, Application Logic, Persistence) and I want to have my transactions in hibernate per request so that I am not making a transaction every time i want to do something and also that I can have data tracking with my objects so that only the properties that were changed are updated.

I have looked at spring as a framework for this and as much as I would love to implement this my group has vetoed it and we cannot use it.

I have also looked at JTA and I cannot see how it would be of use as I am not using beans.

I have thought about a solution such as having a method to call to close and open transactions but it seems like there could be a more elegant solution.

What would be the best way to keep my transaction per request based on my system?


Solution

  • Apache provides a SessionFilter for Hibernate, instructions after the click.