Hi,
I've developed a web based application which does NOT use the Transaction per request pattern nor JTA transactions. Instead my current session is obtained via plain JDBC. My current session and my currenct transaction are both bound to a ThreadLocal variables.
My session is opened with a servlet filter and closed at the end of every request (I don't use disconnected sessions). My transaction is started at the beginning of each transactional method (by using the ThreadLocal instance) and commited at the end of the method. Within one request (and one session) multiple transactions can occur (with multiple commits).
When starting the application everything is fine, but after running a while i get problems. Hibernate doesn't generate all the SQL code that is needed. At the beginning all INSERT, UPDATE and DELETE statements are fine, but now some statement are no longer executed (they don't appear in the logfiles) and I just don't know why.
My questions are:
- Has anybody ever had similiar problems?
- How does hibernate decide if it should generated SQL or if not?
- Can this be a synchronization issuel (also I'm using ThreadLocal) ?
- Is their a recommendation for using JTA transaction, also I'm not using EJBs and want to do transaction handling on my own?
- Should I close the hibernate session after each transaction?
Hibernate version: 3.05
Name and version of the database you are using: IBM DB2 400 V5R3
|