[
https://hibernate.onjira.com/browse/HHH-7265?page=com.atlassian.jira.plug...
]
Gail Badner commented on HHH-7265:
----------------------------------
IIUC, the session should not be auto-closed after the transaction completes for
PersistenceContextType.EXTENDED unless the EntityManager is closed.
I couldn't find a way to enable session auto-close when the EntityManager is closed
without adding a setter to SessionImplementor. Maybe I'm missing something here?
I created a pull request (
https://github.com/hibernate/hibernate-orm/pull/320) that
removes the synchronization that gets registered by EntityManagerImpl.close(). Instead the
synchronization will be added by
AbstractEntityManagerImpl$AfterCompletionActionImpl.doAction() if the session is still
open, but the entity manager is closed. Adding the synchronization here should ensure that
it's the last afterCompletion synchronization that closes the session.
It would be tidier if AfterCompletionAction had something like
"doAfterAfterCompletionAction" that simply closed the session (rather than
relying on a synchronization to do it).
See documentation in the pull request code for more info.
ConcurrentModificationException in
SynchronizationRegistryImpl.notifySynchronizationsAfterTransactionCompletion due to
SynchronizationRegistryImpl.clearSynchronizations clearing
SynchronizationRegistryImpl.synchronizations
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-7265
URL:
https://hibernate.onjira.com/browse/HHH-7265
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.2
Environment: AS7 7.1.1
Reporter: Scott Marlow
Assignee: Gail Badner
Fix For: 4.1.3
Attachments: hibernatesearchsync.jpg
forum post link here includes the AS7 test case and description
https://community.jboss.org/thread/197649?start=0&tstart=0
http://pastie.org/3819424 is the call stack showing
SynchronizationRegistryImpl.notifySynchronizationsAfterTransactionCompletion looping on
synchronization which is cleared mid-loop by
SynchronizationRegistryImpl.clearSynchronizations
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira