There are several new API methods in the upcoming JPA 3.2 (Jakarta EE 11) that might be interesting to support in Spring's JPA container arrangement, e.g. Query.getSingleResultOrNull and EntityManagerFactory.run/callInTransaction:

https://deploy-preview-652--jakartaee-specifications.netlify.app/specifications/persistence/3.2/

Comment From: Petros1020

Hi I would like to work on this issue.

Comment From: Petros1020

@jhoeller any update on this?

Comment From: jhoeller

@Petros1020 first of all, thanks for volunteering! This is in the works already so we are not quite expecting external contributions here, at least not for the above-mentioned Query and EntityManagerFactory additions. That said, if there are any other JPA 3.2 related enhancements that we can support, feel free to investigate them and provide corresponding pull requests.

Comment From: jhoeller

It turns out that there are only two new methods to immediately support in Spring's JPA proxies: Query.getSingleResultOrNull() and EntityManagerFactory.getName().

The aforementioned EntityManagerFactory.run/callInTransaction methods are semantically defined to operate on a new EntityManager instance for every callback. It is not clear whether exposing a Spring-managed transactional EntityManager is ever desirable there. Let's see how persistence providers actually implement this and how it actually gets used in practice before making any further steps.

Last but not least, JPA 3.2 comes with a new PersistenceConfiguration API for creating non-container persistence units that we could possibly support on LocalEntityManagerFactoryBean: accepting a user-provided configuration instance via setPersistenceConfiguration - and possibly using it underneath the covers for further configuration options that match LocalContainerEntityManagerFactoryBean capabilities, e.g. setManagedTypes and setPackagesToScan.