-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Isolation support for JPA with Hibernate EntityManager 4 [SPR-11942] #16559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Juergen Hoeller commented The main reason why we're still not providing this is the lack of a proper resource cleanup callback in JPA... Storing the Connection and cleaning it up after JPA commit isn't reliable, unfortunately, since the Connection will already have been returned to the connection pool by JPA before... So one would actually clean up a connection that you don't own anymore; it might even have been handed out to another caller on another thread in the meantime. Another variant suggested was to let the connection pool restore the isolation level to a default every time a connection is being returned to the pool. That would be reliable but unfortunately Spring doesn't control the connection pool that you're using; so that solution would only work in a custom arrangement like that. We can't prevent misuse of it. All of that said, we can revisit the problem against the latest JPA provider implementations and see whether there's anything new we can do there. Juergen |
Manuel Jordan commented Thanks by the explanation. Perhaps who is behind of HibernateJpaVendorAdapter should does this improvement. |
Juergen Hoeller commented As per my comment on #13599, we could use an opt-in mode where - based on a specific deployment flag, or based on well-known connection pools - we do allow for the use of setReadOnly and setIsolationLevel. Given how popular this request is, I'm considering to revisit this for 4.1 still. Juergen |
Manuel Jordan commented Hi Juergen, thanks by your support and by let me know the status of this situation. Yes popular and crucial, how you can see mostly due by Spring Data JPA. I have a friendly suggestion, when the time be appropriate, would you write a blog post about this new feature?. I am sure the audience would be happy reading and understanding the problem and how Spring resolves that problem with the new feature. I thought it has been solved through JEE 7 by itself, but seems they trust through "Lock Mode". Thank You. |
Juergen Hoeller commented As of 4.1 RC2, Analogous to Juergen |
Manuel Jordan commented Thank You Juergen, it is going to be fantastic for the community! How a friendly suggestion, a post about this in the Spring.io's blog would be very interesting. |
Senén de Diego commented Hello, |
Juergen Hoeller commented Please create a separate JIRA issue for isolation level support with EclipseLink... We'll see what we can do in time for 4.1.2 still. Juergen |
Senén de Diego commented Senén |
Uh oh!
There was an error while loading. Please reload this page.
Manuel Jordan opened SPR-11942 and commented
I am doing a research about Spring Framework and explicitly with
@Transactional
, it working together with JdbcTemplate, Hibernate, JPA, and finally with Spring Data - JPA. A project for each one of course.I have a huge problem, the projects based with JPA and Spring Data JPA, do not work in a 100% with
@Transanctional
through Isolations: the following error message appears:"Standard JPA does not support custom isolation levels - use a special JpaDialect for your JPA implementation"
I know it is a problem by itself of JPA. I did a research in Google and practically all have the same solution, create a customized class to around this problem.
I think Spring Framework should has available an own implementation functional and tested for the community. Isolations are very important.
If I am hired to do a migration from any Spring Project where it works with Jdbc/Hibernate, I am not able to migrate to Spring Data JPA. Because I am totally sure the services for complex use cases are working with Isolations, for example Serializable, for example for Kardex/Warehouse stock control and same consideration about cash, it closely related in the scenario for many users/threads (cashier) in a Mall.
Would be possible see Isolation support for Spring Framework: 4.1.x or 4.6.x?.
Thank You
Affects: 4.0.5
Issue Links:
1 votes, 6 watchers
The text was updated successfully, but these errors were encountered: