public void dispose() { logger.trace( "Disposing DroolsSpringJpaManager" ); if ( internalAppScopedEntityManager ) { //TransactionSynchronizationManager.unbindResource( "appEM" ); TransactionSynchronizationManager.unbindResource( this.emf ); if ( this.appScopedEntityManager != null && this.appScopedEntityManager.isOpen() ) { this.appScopedEntityManager.close(); this.internalAppScopedEntityManager = false; this.env.set( EnvironmentName.APP_SCOPED_ENTITY_MANAGER, null ); this.appScopedEntityManager = null; } this.endCommandScopedEntityManager(); } }
public DroolsSpringJpaManager(Environment env) { this.env = env; this.emf = (EntityManagerFactory) env.get( EnvironmentName.ENTITY_MANAGER_FACTORY ); isJTA = true; Boolean bool = (Boolean) env.get("IS_JTA_TRANSACTION"); if (bool != null) { isJTA = bool.booleanValue(); } getApplicationScopedPersistenceContext(); // we create this on initialisation so that we own the EMF reference // otherwise Spring will close it after the transaction finishes }
public void endCommandScopedEntityManager() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { TransactionSynchronizationManager.unbindResource( "cmdEM" ); if ( this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ) != null ) { getCommandScopedPersistenceContext().close(); } } }
public void endCommandScopedEntityManager() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { TransactionSynchronizationManager.unbindResource( "cmdEM" ); if ( this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ) != null ) { getCommandScopedPersistenceContext().close(); } } }
public void endCommandScopedEntityManager() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { TransactionSynchronizationManager.unbindResource( "cmdEM" ); if ( this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ) != null ) { getCommandScopedPersistenceContext().close(); } } }
public DroolsSpringJpaManager(Environment env) { this.env = env; this.emf = (EntityManagerFactory) env.get( EnvironmentName.ENTITY_MANAGER_FACTORY ); isJTA = true; Boolean bool = (Boolean) env.get("IS_JTA_TRANSACTION"); if (bool != null) { isJTA = bool.booleanValue(); } getApplicationScopedPersistenceContext(); // we create this on initialisation so that we own the EMF reference // otherwise Spring will close it after the transaction finishes }
public void dispose() { logger.trace( "Disposing DroolsSpringJpaManager" ); if ( internalAppScopedEntityManager ) { //TransactionSynchronizationManager.unbindResource( "appEM" ); TransactionSynchronizationManager.unbindResource( this.emf ); if ( this.appScopedEntityManager != null && this.appScopedEntityManager.isOpen() ) { this.appScopedEntityManager.close(); this.internalAppScopedEntityManager = false; this.env.set( EnvironmentName.APP_SCOPED_ENTITY_MANAGER, null ); this.appScopedEntityManager = null; } this.endCommandScopedEntityManager(); } }
public void beginCommandScopedEntityManager() { EntityManager cmdScopedEntityManager = (EntityManager) env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager == null || !cmdScopedEntityManager.isOpen() ) { EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource( "cmdEM" ); EntityManager em = null; if ( emHolder == null ) { em = this.emf.createEntityManager(); emHolder = new EntityManagerHolder( em ); TransactionSynchronizationManager.bindResource( "cmdEM", emHolder ); } else { em = emHolder.getEntityManager(); } this.env.set( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER, em ); } if (isJTA) { this.getCommandScopedPersistenceContext().joinTransaction(); this.appScopedEntityManager.joinTransaction(); } }
public DroolsSpringJpaManager(Environment env) { this.env = env; this.emf = (EntityManagerFactory) env.get( EnvironmentName.ENTITY_MANAGER_FACTORY ); isJTA = true; Boolean bool = (Boolean) env.get("IS_JTA_TRANSACTION"); if (bool != null) { isJTA = bool.booleanValue(); } getApplicationScopedPersistenceContext(); // we create this on initialisation so that we own the EMF reference // otherwise Spring will close it after the transaction finishes }
public void dispose() { logger.trace( "Disposing DroolsSpringJpaManager" ); if ( internalAppScopedEntityManager ) { //TransactionSynchronizationManager.unbindResource( "appEM" ); TransactionSynchronizationManager.unbindResource( this.emf ); if ( this.appScopedEntityManager != null && this.appScopedEntityManager.isOpen() ) { this.appScopedEntityManager.close(); this.internalAppScopedEntityManager = false; this.env.set( EnvironmentName.APP_SCOPED_ENTITY_MANAGER, null ); this.appScopedEntityManager = null; } this.endCommandScopedEntityManager(); } }
public void beginCommandScopedEntityManager() { EntityManager cmdScopedEntityManager = (EntityManager) env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager == null || !cmdScopedEntityManager.isOpen() ) { EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource( "cmdEM" ); EntityManager em = null; if ( emHolder == null ) { em = this.emf.createEntityManager(); emHolder = new EntityManagerHolder( em ); TransactionSynchronizationManager.bindResource( "cmdEM", emHolder ); } else { em = emHolder.getEntityManager(); } this.env.set( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER, em ); } if (isJTA) { this.getCommandScopedPersistenceContext().joinTransaction(); this.appScopedEntityManager.joinTransaction(); } }
public void beginCommandScopedEntityManager() { EntityManager cmdScopedEntityManager = (EntityManager) env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager == null || !cmdScopedEntityManager.isOpen() ) { EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource( "cmdEM" ); EntityManager em = null; if ( emHolder == null ) { em = this.emf.createEntityManager(); emHolder = new EntityManagerHolder( em ); TransactionSynchronizationManager.bindResource( "cmdEM", emHolder ); } else { em = emHolder.getEntityManager(); } this.env.set( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER, em ); } if (isJTA) { this.getCommandScopedPersistenceContext().joinTransaction(); this.appScopedEntityManager.joinTransaction(); } }