I am using Spring transaction with hibernate jpa. I have one active transaction inside which i created a transaction using Propogation.RequiredNew how to make first transaction session data available in next transaction
Asked
Active
Viewed 117 times
0
-
Please, have a look at https://stackoverflow.com/help/how-to-ask – Evhz Jul 03 '17 at 10:50
1 Answers
0
Hibernate's Sessions can begin and commit several transactions. You need to ensure that your Hibernate session is kept open for the duration of the request rather than just for an individual transaction.
I don't the details of your implementation, I guess you can do one of the following;
- You can achieve this using the
OpenSessionInView
pattern. This will ensure your Hibernate session kept open for request rather for individual transaction. - You can store the open session, but then you need to make sure it has no problem with concurrency as session objects are not thread safe.

fabfas
- 2,200
- 1
- 21
- 21