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

Support JPA 2.1 (JSR-338) [SPR-8194] #12843

Closed
spring-issuemaster opened this Issue Apr 4, 2011 · 4 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

spring-issuemaster commented Apr 4, 2011

Chris Beams opened SPR-8194 and commented

JPA 2.1 (building on our JPA 2.0 support in Spring 3.0)

Most importantly, this is about synchronized vs unsynchronized persistence contexts: createEntityManager(SynchronizationType.SYNCHRONIZED/UNSYNCHRONIZED, Map) as well as @PersistenceContext(synchronizationType=SYNCHRONIZED/UNSYNCHRONIZED) for both transactional and extended EntityManagers - and both for Spring-managed resource transactions and JTA transactions.


Referenced from: commits ff160f9, 9f9dc34

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Mar 27, 2013

Juergen Hoeller commented

In the course of this effort, our joinTransaction() support has been overhauled to work for shared EntityManagers as well, since an unsynchronized shared EntityManager will nevertheless be scoped for the current transaction but not automatically join it (as per the JPA 2.1 spec). In the JTA case, we'll simply create an unsynchronized target EntityManager and will upgrade it to a synchronized one (later in the same transaction, if necessary) through an implicit joinTransaction() call. In the JpaTransactionManager case, we'll unbind the primary target EntityManager and will expose an unsynchronized EntityManager instead, upgrading it the same way as with JTA, with the primary EntityManager in that case just serving as a vehicle for transaction begin/commit/rollback calls.

For extended EntityManagers, we've just added further combinations to the existing variants: application-managed EntityManagers which may nevertheless auto-join transactions (EntityManagerFactory.createEntityManager with SynchronizationType.SYNCHRONIZED), and container-managed EntityManagers which might opt for not auto-joining transactions (@PersistenceContext with synchronizationType=UNSYNCHRONIZED).

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Jul 17, 2013

Eric Westfall commented

I was wondering if something might have been missed here. Namely the introduction of "Converters". From what I can tell, it seems like the list of entityTypeFilters on DefaultPersistenceUnitManager should have Converter.class added to it (albeit in a way that is backward compatible). That way any package scanning will also scan for converters. If you agree, I can create a jira for that. Thanks.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Jul 17, 2013

Juergen Hoeller commented

Good point, we should autodetect Converters in the classpath as well when the JPA 2.1 API is present. We can probably address this for 4.0 M2 still.

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Jul 17, 2013

Eric Westfall commented

Great, I wrote a quick patch for DefaultPersistenceUnitManager which handles the situation there. I can share that if interested, otherwise I suspect this is a simple enhancement for you guys so you may not need it, but just let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment