Tabnine Logo
SessionImplementor.getTransactionCoordinator
Code IndexAdd Tabnine to your IDE (free)

How to use
getTransactionCoordinator
method
in
org.hibernate.engine.spi.SessionImplementor

Best Java code snippets using org.hibernate.engine.spi.SessionImplementor.getTransactionCoordinator (Showing top 20 results out of 315)

origin: hibernate/hibernate-orm

@Override
public TransactionCoordinator getTransactionCoordinator() {
  return delegate.getTransactionCoordinator();
}
origin: hibernate/hibernate-orm

  @Override
  public void doAction(boolean successful, SessionImplementor session) {
    if ( session.isClosed() ) {
      log.trace( "Session was closed; nothing to do" );
      return;
    }

    if ( !successful && session.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta() ) {
      session.clear();
    }
  }
}
origin: hibernate/hibernate-orm

private void completeStrayTransaction() {
  if ( session == null ) {
    // nothing to do
    return;
  }
  if ( ( (SessionImplementor) session ).isClosed() ) {
    // nothing to do
    return;
  }
  if ( !session.isConnected() ) {
    // nothing to do
    return;
  }
  final TransactionCoordinator.TransactionDriver tdc =
      ( (SessionImplementor) session ).getTransactionCoordinator().getTransactionDriverControl();
  if ( tdc.getStatus().canRollback() ) {
    session.getTransaction().rollback();
  }
  session.close();
}
origin: hibernate/hibernate-orm

if ( !session.getTransactionCoordinator().isActive() ) {
  log.debug( "Skipping envers transaction hook due to non-active (most likely marked-rollback-only) transaction" );
  return;
origin: hibernate/hibernate-orm

private void completeStrayTransaction() {
  if ( session == null ) {
    // nothing to do
    return;
  }
  if ( ( (SessionImplementor) session ).isClosed() ) {
    // nothing to do
    return;
  }
  if ( !session.isConnected() ) {
    // nothing to do
    return;
  }
  final TransactionCoordinator.TransactionDriver tdc =
      ( (SessionImplementor) session ).getTransactionCoordinator().getTransactionDriverControl();
  if ( tdc.getStatus().canRollback() ) {
    session.getTransaction().rollback();
  }
}
origin: hibernate/hibernate-orm

  @Test
  @TestForIssue( jiraKey = "HHH-9859" )
  public void testExpectations() {
    // JPA spec is very vague on what should happen here.  It does vaguely
    // imply that javax.persistence.EntityManager.joinTransaction() should only be used
    // for JTA EMs, however it does not enforced that nor does the TCK check that.
    // And the TCK in fact does test calls to javax.persistence.EntityManager.isJoinedToTransaction()
    // from resource-local EMs, so lets make sure those work..

    Session session = sessionFactory().openSession();
    JdbcResourceLocalTransactionCoordinatorImpl tc = ExtraAssertions.assertTyping(
        JdbcResourceLocalTransactionCoordinatorImpl.class,
        ( (SessionImplementor) session ).getTransactionCoordinator()
    );
    assertFalse( tc.isJoined() );

    session.beginTransaction();
    tc = ExtraAssertions.assertTyping(
        JdbcResourceLocalTransactionCoordinatorImpl.class,
        ( (SessionImplementor) session ).getTransactionCoordinator()
    );
    assertTrue( tc.isJoined() );

    session.getTransaction().rollback();
    session.close();
  }
}
origin: hibernate/hibernate-orm

sf,
session-> {
  final TransactionCoordinator coordinator = session.getTransactionCoordinator();
origin: hibernate/hibernate-orm

sf,
session -> {
  final TransactionCoordinator coordinator = session.getTransactionCoordinator();
origin: hibernate/hibernate-orm

@Test
public void basicUsageTest() {
  try ( final SessionFactoryImplementor sf = generateSessionFactory() ) {
    inSession(
        sf,
        session-> {
          final TransactionCoordinator coordinator = session.getTransactionCoordinator();
          final SynchronizationCollectorImpl sync = new SynchronizationCollectorImpl();
          coordinator.getLocalSynchronizations()
              .registerSynchronization( sync );
          coordinator.getTransactionDriverControl().begin();
          assertEquals( 0, sync.getBeforeCompletionCount() );
          assertEquals( 0, sync.getSuccessfulCompletionCount() );
          assertEquals( 0, sync.getFailedCompletionCount() );
          coordinator.getTransactionDriverControl().commit();
          assertEquals( 1, sync.getBeforeCompletionCount() );
          assertEquals( 1, sync.getSuccessfulCompletionCount() );
          assertEquals( 0, sync.getFailedCompletionCount() );
        }
    );
  }
}
origin: hibernate/hibernate-search

private boolean isLocalTransaction(SessionImplementor sessionImplementor) {
  return !sessionImplementor
      .getTransactionCoordinator()
      .getTransactionCoordinatorBuilder()
      .isJta();
}
origin: org.infinispan/infinispan-hibernate-cache-v51

@Override
public TransactionCoordinatorAccess getTransactionCoordinator(Object session) {
 return session == null ? null
   : new TransactionCoordinatorAccessImpl(unwrap(session).getTransactionCoordinator());
}
origin: com.blazebit/blaze-persistence-integration-hibernate-4.3

@Override
public SessionImplementor wrapSession(SessionImplementor session, DbmsDialect dbmsDialect, String[][] columns, int[] returningSqlTypes, HibernateReturningResult<?> returningResult) {
  TransactionCoordinator transactionCoordinator = session.getTransactionCoordinator();
  JdbcCoordinator jdbcCoordinator = transactionCoordinator.getJdbcCoordinator();
  
  Object jdbcCoordinatorProxy = Proxy.newProxyInstance(jdbcCoordinator.getClass().getClassLoader(), new Class[]{ JdbcCoordinator.class }, new JdbcCoordinatorInvocationHandler(jdbcCoordinator, new StatementPreparerImpl(jdbcCoordinator, session.getFactory(), dbmsDialect, columns, returningSqlTypes, returningResult)));
  Object transactionCoordinatorProxy = Proxy.newProxyInstance(transactionCoordinator.getClass().getClassLoader(), new Class[]{ TransactionCoordinator.class }, new Hibernate43TransactionCoordinatorInvocationHandler(transactionCoordinator, jdbcCoordinatorProxy));
  Object sessionProxy = Proxy.newProxyInstance(session.getClass().getClassLoader(), new Class[]{ SessionImplementor.class, EventSource.class }, new Hibernate43SessionInvocationHandler(session, transactionCoordinatorProxy));
  return (SessionImplementor) sessionProxy;
}
origin: org.hibernate/com.springsource.org.hibernate.core

private void executeActions(List list) throws HibernateException {
  for ( Object aList : list ) {
    execute( (Executable) aList );
  }
  list.clear();
  session.getTransactionCoordinator().getJdbcCoordinator().executeBatch();
}
origin: org.hibernate/com.springsource.org.hibernate.core

protected PreparedStatement prepare(String insertSQL, SessionImplementor session) throws SQLException {
  return session.getTransactionCoordinator()
      .getJdbcCoordinator()
      .getStatementPreparer()
      .prepareStatement( insertSQL, PreparedStatement.RETURN_GENERATED_KEYS );
}
origin: org.hibernate/com.springsource.org.hibernate

protected PreparedStatement prepare(String insertSQL, SessionImplementor session) throws SQLException {
  return session.getTransactionCoordinator()
      .getJdbcCoordinator()
      .getStatementPreparer()
      .prepareStatement( insertSQL, PreparedStatement.RETURN_GENERATED_KEYS );
}
origin: org.hibernate/com.springsource.org.hibernate.core

protected PreparedStatement prepare(String insertSQL, SessionImplementor session) throws SQLException {
  return session.getTransactionCoordinator()
      .getJdbcCoordinator()
      .getStatementPreparer()
      .prepareStatement( insertSQL, PreparedStatement.NO_GENERATED_KEYS );
}
origin: com.blazebit/blaze-persistence-integration-hibernate-6.0

@Override
public void checkTransactionSynchStatus(SessionImplementor session) {
  TransactionCoordinator coordinator = session.getTransactionCoordinator();
  coordinator.pulse();
  if (coordinator instanceof JtaTransactionCoordinatorImpl) {
    ((JtaTransactionCoordinatorImpl) coordinator).getSynchronizationCallbackCoordinator().processAnyDelayedAfterCompletion();
  }
}
origin: com.github.mg365/mg-common

  @Override
  public IntegralDataTypeHolder getNextValue() {
    return session.getTransactionCoordinator().getTransaction().createIsolationDelegate().delegateWork(abstractReturningWork, true);
  }
};
origin: com.blazebit/blaze-persistence-integration-hibernate-6.0

@Override
public void afterTransaction(SessionImplementor session, boolean success) {
  TransactionCoordinator coordinator = session.getTransactionCoordinator();
  if (!session.isTransactionInProgress() ) {
    session.getJdbcCoordinator().afterTransaction();
  }
  if (coordinator instanceof JtaTransactionCoordinatorImpl) {
    ((JtaTransactionCoordinatorImpl) coordinator).getSynchronizationCallbackCoordinator().processAnyDelayedAfterCompletion();
  }
}
origin: com.blazebit/blaze-persistence-integration-hibernate-5.2

@Override
public void afterTransaction(SessionImplementor session, boolean success) {
  TransactionCoordinator coordinator = session.getTransactionCoordinator();
  if (!session.isTransactionInProgress() ) {
    session.getJdbcCoordinator().afterTransaction();
  }
  if (coordinator instanceof JtaTransactionCoordinatorImpl) {
    ((JtaTransactionCoordinatorImpl) coordinator).getSynchronizationCallbackCoordinator().processAnyDelayedAfterCompletion();
  }
}
org.hibernate.engine.spiSessionImplementorgetTransactionCoordinator

Javadoc

Retrieve access to the session's transaction coordinator.

Popular methods of SessionImplementor

  • getFactory
    Get the creating SessionFactoryImplementor
  • connection
  • getPersistenceContext
    Get the persistence context for this session
  • getLoadQueryInfluencers
    Get the load query influencers associated with this session.
  • isTransactionInProgress
    Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?
  • getEntityPersister
    Get the EntityPersister for any instance
  • getJdbcCoordinator
  • isClosed
    Determine whether the session is closed. Provided separately from #isOpen() as this method does not
  • flush
  • getTenantIdentifier
    Match te method on org.hibernate.Session and org.hibernate.StatelessSession
  • generateEntityKey
  • getContextEntityIdentifier
  • generateEntityKey,
  • getContextEntityIdentifier,
  • isOpen,
  • bestGuessEntityName,
  • getFlushMode,
  • getSessionFactory,
  • guessEntityName,
  • immediateLoad,
  • initializeCollection

Popular in Java

  • Updating database using SQL prepared statement
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • putExtra (Intent)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • BoxLayout (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now