-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Doc: HibernateJpaVendorAdapter's "prepareConnection" may interfere with Hibernate 5.1+ in a JTA environment [SPR-14957] #19524
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
Alexandru-Constantin Bledea commented I also opened an issue on the hibernate issue tracker |
Alexandru-Constantin Bledea commented This is the commit that breaks the previous behavior |
Alexandru-Constantin Bledea commented It looks like the issue is setting the default modes for spring 5.1.x and spring 5.2.x For 5.1.x, using these settings (just to override the automatic override in HibernateJpaVendorAdapter), this issue doesn't manifest itself in jta anymore <bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="default"/>
<property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.connection.release_mode" value="auto"/>
</map>
</property>
</bean> For 5.2.x, using these settings (just to override the automatic override in HibernateJpaVendorAdapter), this issue doesn't manifest itself in jta anymore <bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="default"/>
<property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.connection.handling_mode" value="DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT"/>
</map>
</property>
</bean> In 5.0.x the default mode for JdbcResourceLocalTransaction was indeed ON_CLOSE, however for JtaTransaction it was AFTER_STATEMENT. It looks like this wasn't taken into account when the 'revert' to the default mode was added. |
Juergen Hoeller commented This is essentially a known issue: The underlying technical problem is that we can't influence Hibernate's connection release mode depending on the transaction setup: simply because JPA doesn't allow us to reliably introspect the transaction setup in general. As a consequence, The easiest way out would be to set |
Stéphane Nicoll opened SPR-14957 and commented
See spring-projects/spring-boot#7455 (a sample is available).
The reporter experiences a difference of behaviour when
OpenEntityManagerInViewFilter
is enabled on a Spring MVC application using Weblogic and Hibernate 5.1 or 5.2. The same code works fine with 5.0I am wondering if that's a regression in our Hibernate support or in Hibernate itself.
Affects: 4.3.4
Issue Links:
Referenced from: commits 2f80b84, 04af30d
The text was updated successfully, but these errors were encountered: