Codota Logo
SessionImplementor.accessTransaction
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain SessionImplementor
private void myMethod () {
SessionImplementor s =
  • Codota IconEntityManager entityManager;entityManager.unwrap(SessionImplementor.class)
  • Codota IconFlushEntityEvent flushEntityEvent;flushEntityEvent.getSession()
  • Codota IconLazyInitializer lazyInitializer;lazyInitializer.getSession()
  • Smart code suggestions by Codota
}
origin: hibernate/hibernate-orm

@Override
public Transaction accessTransaction() {
  return delegate.accessTransaction();
}
origin: org.hibernate.orm/hibernate-core

@Override
public Transaction accessTransaction() {
  return delegate.accessTransaction();
}
origin: com.atlassian.hibernate/hibernate.adapter

@Override
public Transaction accessTransaction() {
  return getSessionImplementor().accessTransaction();
}
origin: hibernate/hibernate-search

private void rollbackTransaction(SessionImplementor session) throws Exception {
  try {
    if ( transactionManager != null ) {
      transactionManager.rollback();
    }
    else {
      session.accessTransaction().rollback();
    }
  }
  catch (Exception e) {
    log.errorRollingBackTransaction( e.getMessage(), e );
  }
}
origin: hibernate/hibernate-search

private void rollbackTransaction(SessionImplementor session) throws Exception {
  try {
    if ( transactionManager != null ) {
      transactionManager.rollback();
    }
    else {
      session.accessTransaction().rollback();
    }
  }
  catch (Exception e) {
    log.errorRollingBackTransaction( e.getMessage(), e );
  }
}
origin: hibernate/hibernate-search

@Override
public void purge(String entity) {
  Class<?> clazz = getEntityClass( entity );
  try ( Session session = hibernateSessionFactory.openSession() ) {
    FullTextSession fullTextSession = Search.getFullTextSession( session );
    Transaction transaction = ( (SessionImplementor) session ).accessTransaction();
    final boolean controlTransactions = ! transaction.isActive();
    if ( controlTransactions ) {
      transaction.begin();
    }
    try {
      fullTextSession.purgeAll( clazz );
    }
    finally {
      if ( controlTransactions ) {
        transaction.commit();
      }
    }
  }
}
origin: hibernate/hibernate-search

HibernateOrmSearchManager searchManager = getSearchManager( sessionImplementor );
if ( sessionImplementor.isTransactionInProgress() ) {
  final Transaction transactionIdentifier = sessionImplementor.accessTransaction();
  TransientReference<Map<Transaction, PojoWorkPlan>> reference =
      (TransientReference<Map<Transaction, PojoWorkPlan>>) sessionImplementor.getProperties()
origin: hibernate/hibernate-search

private void registerSynchronization(SessionImplementor sessionImplementor, Synchronization synchronization) {
  //use {Before|After}TransactionCompletionProcess instead of registerSynchronization because it does not
  //swallow transactions.
  /*
   * HSEARCH-540: the pre process must be both a BeforeTransactionCompletionProcess and a TX Synchronization.
   *
   * In a resource-local tx env, the beforeCommit phase is called after the flush, and prepares work queue.
   * Also, any exceptions that occur during that are propagated (if a Synchronization was used, the exceptions
   * would be eaten).
   *
   * In a JTA env, the before transaction completion is called before the flush, so not all changes are yet
   * written. However, Synchronization-s do propagate exceptions, so they can be safely used.
   */
  final ActionQueue actionQueue = sessionImplementor.getActionQueue();
  SynchronizationAdapter adapter = new SynchronizationAdapter( synchronization );
  boolean isLocal = isLocalTransaction( sessionImplementor );
  if ( isLocal ) {
    //if local tx never use Synchronization
    actionQueue.registerProcess( (BeforeTransactionCompletionProcess) adapter );
  }
  else {
    //TODO could we remove the action queue registration in this case?
    actionQueue.registerProcess( (BeforeTransactionCompletionProcess) adapter );
    sessionImplementor.accessTransaction().registerSynchronization( adapter );
  }
  //executed in all environments
  actionQueue.registerProcess( (AfterTransactionCompletionProcess) adapter );
}
org.hibernate.engine.spiSessionImplementoraccessTransaction

Popular methods of SessionImplementor

  • getFactory
    Get the creating SessionFactoryImplementor
  • getTransactionCoordinator
  • 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
  • getTenantIdentifier,
  • generateEntityKey,
  • getContextEntityIdentifier,
  • isOpen,
  • bestGuessEntityName,
  • getFlushMode,
  • getSessionFactory,
  • guessEntityName,
  • immediateLoad,
  • initializeCollection

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now