/** * Used by JDK serialization... * * @param oos The output stream to which we are being written... * * @throws IOException Indicates a general IO stream exception */ private void writeObject(ObjectOutputStream oos) throws IOException { if ( TRACE_ENABLED ) { log.tracef( "Serializing Session [%s]", getSessionIdentifier() ); } oos.defaultWriteObject(); persistenceContext.serialize( oos ); actionQueue.serialize( oos ); oos.writeObject( loadQueryInfluencers ); }
private void logRemoveOrphanBeforeUpdates(String timing, String entityName, Object entity) { final EntityEntry entityEntry = persistenceContext.getEntry( entity ); log.tracef( "%s remove orphan before updates: [%s]", timing, entityEntry == null ? entityName : MessageHelper.infoString( entityName, entityEntry.getId() ) ); }
private void parsePersistenceXml(URL xmlUrl, Map integration) { LOG.tracef( "Attempting to parse persistence.xml file : %s", xmlUrl.toExternalForm() );
private void bindPersistenceUnit(ParsedPersistenceXmlDescriptor persistenceUnit, Element persistenceUnitElement) { final String name = persistenceUnitElement.getAttribute( "name" ); if ( StringHelper.isNotEmpty( name ) ) { LOG.tracef( "Persistence unit name from persistence.xml : %s", name ); persistenceUnit.setName( name );
@Override public void beforeTransactionCompletion() { log.tracef( "SessionImpl#beforeTransactionCompletion()" ); flushBeforeTransactionCompletion(); actionQueue.beforeTransactionCompletion(); try { getInterceptor().beforeTransactionCompletion( getCurrentTransaction() ); } catch (Throwable t) { log.exceptionInBeforeTransactionCompletionInterceptor( t ); } super.beforeTransactionCompletion(); }
log.tracef( "Deserializing Session [%s]", getSessionIdentifier() );
public void closeWithoutOpenChecks() throws HibernateException { if ( TRACE_ENABLED ) { log.tracef( "Closing session [%s]", getSessionIdentifier() ); } // todo : we want this check if usage is JPA, but not native Hibernate usage if ( getSessionFactory().getSessionFactoryOptions().isJpaBootstrap() ) { // Original hibernate-entitymanager EM#close behavior checkSessionFactoryOpen(); checkOpenOrWaitingForAutoClose(); if ( discardOnClose || !isTransactionInProgress( false ) ) { super.close(); } else { //Otherwise, session auto-close will be enabled by shouldAutoCloseSession(). waitingForAutoClose = true; closed = true; } } else { super.close(); } if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().closeSession(); } }
if ( property.isSynthetic() ) { LOG.tracef( "Skipping synthetic property %s(%s)", ownerType.getName(), property.getName() ); return null;
@Override public void afterTransactionCompletion(boolean successful, boolean delayed) { log.tracef( "SessionImpl#afterTransactionCompletion(successful=%s, delayed=%s)", successful, delayed ); if ( !isClosed() || waitingForAutoClose ) { if ( autoClear ||!successful ) { internalClear(); } } persistenceContext.afterTransactionCompletion(); actionQueue.afterTransactionCompletion( successful ); getEventListenerManager().transactionCompletion( successful ); if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().endTransaction( successful ); } try { getInterceptor().afterTransactionCompletion( getCurrentTransaction() ); } catch (Throwable t) { log.exceptionInAfterTransactionCompletionInterceptor( t ); } if ( !delayed ) { if ( shouldAutoClose() && (!isClosed() || waitingForAutoClose) ) { managedClose(); } } super.afterTransactionCompletion( successful, delayed ); }
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) { super( factory, options ); this.actionQueue = new ActionQueue( this ); this.persistenceContext = new StatefulPersistenceContext( this ); this.sessionOwner = options.getSessionOwner(); initializeFromSessionOwner( sessionOwner ); this.autoClear = options.shouldAutoClear(); this.autoClose = options.shouldAutoClose(); this.queryParametersValidationEnabled = options.isQueryParametersValidationEnabled(); this.disallowOutOfTransactionUpdateOperations = !factory.getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations(); this.discardOnClose = getFactory().getSessionFactoryOptions().isReleaseResourcesOnCloseEnabled(); if ( options instanceof SharedSessionCreationOptions && ( (SharedSessionCreationOptions) options ).isTransactionCoordinatorShared() ) { final SharedSessionCreationOptions sharedOptions = (SharedSessionCreationOptions) options; if ( sharedOptions.getTransactionCompletionProcesses() != null ) { actionQueue.setTransactionCompletionProcesses( sharedOptions.getTransactionCompletionProcesses(), true ); } } loadQueryInfluencers = new LoadQueryInfluencers( factory ); if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().openSession(); } // NOTE : pulse() already handles auto-join-ability correctly getTransactionCoordinator().pulse(); setDefaultProperties(); applyProperties(); if ( TRACE_ENABLED ) { log.tracef( "Opened Session [%s] at timestamp: %s", getSessionIdentifier(), getTimestamp() ); } }
/** * Used by JDK serialization... * * @param oos The output stream to which we are being written... * * @throws IOException Indicates a general IO stream exception */ private void writeObject(ObjectOutputStream oos) throws IOException { if ( TRACE_ENABLED ) { log.tracef( "Serializing Session [%s]", getSessionIdentifier() ); } oos.defaultWriteObject(); persistenceContext.serialize( oos ); actionQueue.serialize( oos ); oos.writeObject( loadQueryInfluencers ); }
private void logRemoveOrphanBeforeUpdates(String timing, String entityName, Object entity) { final EntityEntry entityEntry = persistenceContext.getEntry( entity ); log.tracef( "%s remove orphan before updates: [%s]", timing, entityEntry == null ? entityName : MessageHelper.infoString( entityName, entityEntry.getId() ) ); }
private void parsePersistenceXml(URL xmlUrl, Map integration) { LOG.tracef( "Attempting to parse persistence.xml file : %s", xmlUrl.toExternalForm() );
private void bindPersistenceUnit(ParsedPersistenceXmlDescriptor persistenceUnit, Element persistenceUnitElement) { final String name = persistenceUnitElement.getAttribute( "name" ); if ( StringHelper.isNotEmpty( name ) ) { LOG.tracef( "Persistence unit name from persistence.xml : %s", name ); persistenceUnit.setName( name );
@Override public void beforeTransactionCompletion() { log.tracef( "SessionImpl#beforeTransactionCompletion()" ); flushBeforeTransactionCompletion(); actionQueue.beforeTransactionCompletion(); try { getInterceptor().beforeTransactionCompletion( getCurrentTransaction() ); } catch (Throwable t) { log.exceptionInBeforeTransactionCompletionInterceptor( t ); } super.beforeTransactionCompletion(); }
log.tracef( "Deserializing Session [%s]", getSessionIdentifier() );
public void closeWithoutOpenChecks() throws HibernateException { if ( TRACE_ENABLED ) { log.tracef( "Closing session [%s]", getSessionIdentifier() ); } // todo : we want this check if usage is JPA, but not native Hibernate usage if ( getSessionFactory().getSessionFactoryOptions().isJpaBootstrap() ) { // Original hibernate-entitymanager EM#close behavior checkSessionFactoryOpen(); checkOpenOrWaitingForAutoClose(); if ( discardOnClose || !isTransactionInProgress( false ) ) { super.close(); } else { //Otherwise, session auto-close will be enabled by shouldAutoCloseSession(). waitingForAutoClose = true; closed = true; } } else { super.close(); } if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().closeSession(); } }
@Override public void afterTransactionCompletion(boolean successful, boolean delayed) { log.tracef( "SessionImpl#afterTransactionCompletion(successful=%s, delayed=%s)", successful, delayed ); if ( !isClosed() || waitingForAutoClose ) { if ( autoClear ||!successful ) { internalClear(); } } persistenceContext.afterTransactionCompletion(); actionQueue.afterTransactionCompletion( successful ); getEventListenerManager().transactionCompletion( successful ); if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().endTransaction( successful ); } try { getInterceptor().afterTransactionCompletion( getCurrentTransaction() ); } catch (Throwable t) { log.exceptionInAfterTransactionCompletionInterceptor( t ); } if ( !delayed ) { if ( shouldAutoClose() && (!isClosed() || waitingForAutoClose) ) { managedClose(); } } super.afterTransactionCompletion( successful, delayed ); }
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) { super( factory, options ); this.actionQueue = new ActionQueue( this ); this.persistenceContext = new StatefulPersistenceContext( this ); this.sessionOwner = options.getSessionOwner(); initializeFromSessionOwner( sessionOwner ); this.autoClear = options.shouldAutoClear(); this.autoClose = options.shouldAutoClose(); this.queryParametersValidationEnabled = options.isQueryParametersValidationEnabled(); this.disallowOutOfTransactionUpdateOperations = !factory.getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations(); this.discardOnClose = getFactory().getSessionFactoryOptions().isReleaseResourcesOnCloseEnabled(); if ( options instanceof SharedSessionCreationOptions && ( (SharedSessionCreationOptions) options ).isTransactionCoordinatorShared() ) { final SharedSessionCreationOptions sharedOptions = (SharedSessionCreationOptions) options; if ( sharedOptions.getTransactionCompletionProcesses() != null ) { actionQueue.setTransactionCompletionProcesses( sharedOptions.getTransactionCompletionProcesses(), true ); } } loadQueryInfluencers = new LoadQueryInfluencers( factory ); if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().openSession(); } // NOTE : pulse() already handles auto-join-ability correctly getTransactionCoordinator().pulse(); setDefaultProperties(); applyProperties(); if ( TRACE_ENABLED ) { log.tracef( "Opened Session [%s] at timestamp: %s", getSessionIdentifier(), getTransactionStartTimestamp() ); } }