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
Spring's JDBC connection access disables shared cache in EclipseLink [SPR-7753] #12409
Comments
Jorg Heymans commented From what i can see EclipseLinkJpaDialect only comes into play when using the JpaTransactionManager, when using JTA above mechanism is not active. |
Igor Mukhin commented I found this workaround to enable shared cache in EclipseLink in Spring environment:
The problematic place in Spring is the method JpaTransactionManager.doBegin(...):
This method obtains the jdbc connection from EclipseLink, which forces EclipseLink to go to non-shared-cache-mode. BUT it wants obtains the jdbc connection only in case +dataSource+ is set, which is strange! |
Juergen Hoeller commented
In any case, point taken that obtaining a JDBC Juergen |
Igor Mukhin commented Thanks, Juergen. Sounds good. |
Juergen Hoeller commented This is available in the latest 4.1.2.BUILD-SNAPSHOT (see http://projects.spring.io/spring-framework/) in the meantime. Would be great if you could give it a try... Juergen |
Igor Mukhin commented Juergen, thanks, it works as you described with:
and
|
James Sutherland opened SPR-7753 and commented
In the EclipseLinkJpaDialect Spring does the following,
This is done to force EclipseLink to read through a transactional connection, so that it can see changes made directly through JDBC. But it has the side-affect of effectively disabling the shared cache in EclipseLink.
EclipseLink will no longer cache any objects read because a transactional connection is being used.
Which connection is used is configurable in EclipseLink by the user, so Spring should not be forcing any setting on the user, and not be using an internal API to do it.
The correct way to enable this is either to set the persistence unit property,
"eclipselink.jdbc.exclusive-connection.mode"="Always" (will allow a shared cache)
or
"eclipselink.transaction.join-existing"="true" (does not allow a shared cache)
If Spring desires different functionality than the EclipseLink defaults (not sure it should), then it should just default these properties if they have "not" already be configured by the user. This would allow the user to choose if they want caching to work or not.
Otherwise just remove this code and let the user configure if they wish to allow caching or not.
Affects: 4.1.1
Issue Links:
Referenced from: commits e4753c9
2 votes, 5 watchers
The text was updated successfully, but these errors were encountered: