https://jira.spring.io/browse/SPR-16956

Comment From: pivotal-issuemaster

@vladmihalcea Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-issuemaster

@vladmihalcea Thank you for signing the Contributor License Agreement!

Comment From: jhoeller

As per our JIRA discussion, this has been rolled into master in a slightly extended fashion, only applying setDefaultReadOnly(true) to transaction-local resources... which means no side effects for later access, and no cleanup neessary. Thanks for the PR, in any case!

Comment From: jwgmeligmeyling

@jhoeller was similar behaviour ever implemented for Hibernate 6?

Comment From: vladmihalcea

@jwgmeligmeyling Yes, the optimizations work just fine with Hibernate 6 because they are applied by the HibernateJpaDialect.

Check out this line in the HibernateJpaDialect for more details.