Today Hibernate does not actually "understand" even what an EXTENDED PC is... WF/Jipijapa handles that and converts it into Hibernate's terms. PersistenceContextType really boils down to 2 things for Hibernate... 1) what is the Session FlushMode 2) should I automatically close the Session after transaction completion
An EXTENDED PC, to Hibernate, would behave like: # {{FlushMode#MANUAL}} # {{false}} (do not automatically close)
I think the most appropriate solution is to simply add a FlushMode check in {{AbstractSaveEventListener#performSaveOrReplicate}} when deciding {{shouldDelayIdentityInserts}}. Specifically, any FlushMode "less than" AUTO should delay the IDENTITY inserts if possible. Something like:
{code} boolean shouldDelayIdentityInserts = !requiresImmediateIdAccess && ( !inTxn || source.getHibernateFlushMode().lessThan( AUTO ) ); {code} |
|