Package org.hibernate.engine.spi

Examples of org.hibernate.engine.spi.SessionBuilderImplementor


  }

  @Override
  protected Session internalGetSession() {
    if ( session == null ) {
      SessionBuilderImplementor sessionBuilder = internalGetEntityManagerFactory().getSessionFactory().withOptions();
      sessionBuilder.owner( this );
      if (sessionInterceptorClass != null) {
        try {
          Interceptor interceptor = (Interceptor) sessionInterceptorClass.newInstance();
          sessionBuilder.interceptor( interceptor );
        }
        catch (InstantiationException e) {
          throw new PersistenceException("Unable to instantiate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (IllegalAccessException e) {
          throw new PersistenceException("Unable to instantiate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (ClassCastException e) {
          throw new PersistenceException("Session interceptor does not implement Interceptor: " + sessionInterceptorClass, e);
        }
      }
      sessionBuilder.autoJoinTransactions( getTransactionType() != PersistenceUnitTransactionType.JTA );
      session = sessionBuilder.openSession();
      if ( persistenceContextType == PersistenceContextType.TRANSACTION ) {
        ( (SessionImplementor) session ).setAutoClear( true );
      }
    }
    return session;
View Full Code Here


  }

  @Override
    protected Session getRawSession() {
    if ( session == null ) {
      SessionBuilderImplementor sessionBuilder = getEntityManagerFactory().getSessionFactory().withOptions();
      sessionBuilder.owner( this );
      if (sessionInterceptorClass != null) {
        try {
          Interceptor interceptor = (Interceptor) sessionInterceptorClass.newInstance();
          sessionBuilder.interceptor( interceptor );
        }
        catch (InstantiationException e) {
          throw new PersistenceException("Unable to instanciate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (IllegalAccessException e) {
          throw new PersistenceException("Unable to instanciate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (ClassCastException e) {
          throw new PersistenceException("Session interceptor does not implement Interceptor: " + sessionInterceptorClass, e);
        }
      }
      sessionBuilder.autoJoinTransactions( getTransactionType() != PersistenceUnitTransactionType.JTA );
      session = sessionBuilder.openSession();
      if ( persistenceContextType == PersistenceContextType.TRANSACTION ) {
        ( (SessionImplementor) session ).setAutoClear( true );
      }
    }
    return session;
View Full Code Here

  }

  @Override
  protected Session internalGetSession() {
    if ( session == null ) {
      SessionBuilderImplementor sessionBuilder = internalGetEntityManagerFactory().getSessionFactory().withOptions();
      sessionBuilder.owner( this );
      if (sessionInterceptorClass != null) {
        try {
          Interceptor interceptor = (Interceptor) sessionInterceptorClass.newInstance();
          sessionBuilder.interceptor( interceptor );
        }
        catch (InstantiationException e) {
          throw new PersistenceException("Unable to instantiate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (IllegalAccessException e) {
          throw new PersistenceException("Unable to instantiate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (ClassCastException e) {
          throw new PersistenceException("Session interceptor does not implement Interceptor: " + sessionInterceptorClass, e);
        }
      }
      sessionBuilder.autoJoinTransactions( getTransactionType() != PersistenceUnitTransactionType.JTA );
      session = sessionBuilder.openSession();
    }
    return session;
  }
View Full Code Here

  }

  @Override
  protected Session internalGetSession() {
    if ( session == null ) {
      SessionBuilderImplementor sessionBuilder = internalGetEntityManagerFactory().getSessionFactory().withOptions();
      sessionBuilder.owner( this );
      if (sessionInterceptorClass != null) {
        try {
          Interceptor interceptor = (Interceptor) sessionInterceptorClass.newInstance();
          sessionBuilder.interceptor( interceptor );
        }
        catch (InstantiationException e) {
          throw new PersistenceException("Unable to instantiate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (IllegalAccessException e) {
          throw new PersistenceException("Unable to instantiate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (ClassCastException e) {
          throw new PersistenceException("Session interceptor does not implement Interceptor: " + sessionInterceptorClass, e);
        }
      }
      sessionBuilder.autoJoinTransactions( getTransactionType() != PersistenceUnitTransactionType.JTA );
      session = sessionBuilder.openSession();
      if ( persistenceContextType == PersistenceContextType.TRANSACTION ) {
        ( (SessionImplementor) session ).setAutoClear( true );
      }
    }
    return session;
View Full Code Here

  }

  @Override
  protected Session internalGetSession() {
    if ( session == null ) {
      SessionBuilderImplementor sessionBuilder = internalGetEntityManagerFactory().getSessionFactory().withOptions();
      sessionBuilder.owner( this );
      if (sessionInterceptorClass != null) {
        try {
          Interceptor interceptor = (Interceptor) sessionInterceptorClass.newInstance();
          sessionBuilder.interceptor( interceptor );
        }
        catch (InstantiationException e) {
          throw new PersistenceException("Unable to instantiate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (IllegalAccessException e) {
          throw new PersistenceException("Unable to instantiate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (ClassCastException e) {
          throw new PersistenceException("Session interceptor does not implement Interceptor: " + sessionInterceptorClass, e);
        }
      }
      sessionBuilder.autoJoinTransactions( getTransactionType() != PersistenceUnitTransactionType.JTA );
      session = sessionBuilder.openSession();
    }
    return session;
  }
View Full Code Here

        private boolean opened;

        public synchronized Session getS() {
            if (s == null) {
                opened = true;
                SessionBuilderImplementor sessionBuilderImplementor = factoryImplementor.withOptions();
                sessionBuilderImplementor.connection(null);
                sessionBuilderImplementor.flushBeforeCompletion(isAutoFlushEnabled());
                sessionBuilderImplementor.autoClose(isAutoCloseEnabled());
                sessionBuilderImplementor.connectionReleaseMode(factoryImplementor.getSettings().getConnectionReleaseMode());
                return s = sessionBuilderImplementor.openSession();
            }
            return s;
        }
View Full Code Here

TOP

Related Classes of org.hibernate.engine.spi.SessionBuilderImplementor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.