Issue Type: Bug Bug
Affects Versions: 4.1.5.SP1
Assignee: Unassigned
Components: entity-manager
Created: 17/Jul/12 3:48 AM
Description:

Currently it seems that in Hibernate the EntityManagerFactory always creates EntityManagers with PersistenceContextType.EXTENDED.

This I think is against the jpa standard, which says that by default PersistenceContextType.TRANSACTION should be used.

Also, normally the user should be able to specify which PersistenceContextType is used, in the @PersistenceContext annotation.

The result of this in our current project is that we had to spend a day finding some very weird issues, caused by the first level cache living longer then expected.
Also, we have no clean way of solving this (I'm thinking of overriding the factory class right now).

This is caused in EntityManagerFactoryImpl.java by this bit of code:
public EntityManager createEntityManager(Map map) { //TODO support discardOnClose, persistencecontexttype?, interceptor, return new EntityManagerImpl( this, PersistenceContextType.EXTENDED, transactionType, discardOnClose, sessionInterceptorClass, map ); }

Project: Hibernate ORM
Priority: Minor Minor
Reporter: Jeroen Cranendonk
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira