Skip to content
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

Initial support for JPA 3.2 #31157

Closed
jhoeller opened this issue Sep 3, 2023 · 4 comments
Closed

Initial support for JPA 3.2 #31157

jhoeller opened this issue Sep 3, 2023 · 4 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@jhoeller
Copy link
Contributor

jhoeller commented Sep 3, 2023

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/

@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement labels Sep 3, 2023
@jhoeller jhoeller added this to the 6.1.x milestone Sep 3, 2023
@jhoeller jhoeller self-assigned this Sep 3, 2023
@jhoeller jhoeller changed the title Align with JPA 3.2 Support for JPA 3.2 Sep 3, 2023
@Petros1020
Copy link

Hi I would like to work on this issue.

@Petros1020
Copy link

@jhoeller any update on this?

@jhoeller
Copy link
Contributor Author

@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.

@jhoeller jhoeller modified the milestones: 6.1.x, 6.1.0-RC1 Sep 13, 2023
@jhoeller jhoeller modified the milestones: 6.1.0-RC1, 6.1.x Oct 10, 2023
@jhoeller jhoeller modified the milestones: 6.1.x, 6.2.x Nov 9, 2023
@jhoeller jhoeller modified the milestones: 6.2.x, 6.2.0-M1 Feb 28, 2024
@jhoeller jhoeller changed the title Support for JPA 3.2 Initial support for JPA 3.2 Feb 28, 2024
@jhoeller
Copy link
Contributor Author

jhoeller commented Feb 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants