Examples of openSession()


Examples of org.hibernate.SessionFactory.openSession()

  public void index(String entity) {
    Class<?> clazz = getEntityClass( entity );

    SessionFactory factory = getSessionFactory();
    Session session = factory.openSession();
    FullTextSession fulltextSession = Search.getFullTextSession( session );
    try {
      fulltextSession.createIndexer( clazz )
          .batchSizeToLoadObjects( batchSize )
          .cacheMode( CacheMode.NORMAL )
View Full Code Here

Examples of org.hibernate.SessionFactory.openSession()

  public void optimize(String entity) {
    Class<?> clazz = getEntityClass( entity );

    SessionFactory factory = getSessionFactory();
    Session session = factory.openSession();
    FullTextSession fullTextSession = Search.getFullTextSession( session );
    fullTextSession.beginTransaction();
    fullTextSession.getSearchFactory().optimize( clazz );
    fullTextSession.getTransaction().commit();
    session.close();
View Full Code Here

Examples of org.hibernate.engine.SessionFactoryImplementor.openSession()

    final SessionFactoryImplementor sf = (SessionFactoryImplementor) sfControl.getMock();
    final MockControl sessionControl = MockControl.createControl(Session.class);
    final Session session = (Session) sessionControl.getMock();
    sf.getTransactionManager();
    sfControl.setReturnValue(tm, 1);
    sf.openSession();
    sfControl.setReturnValue(session, 1);
    session.isOpen();
    sessionControl.setReturnValue(true, 1);

    utControl.replay();
View Full Code Here

Examples of org.hibernate.engine.spi.SessionBuilderImplementor.openSession()

        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

Examples of org.hibernate.engine.spi.SessionBuilderImplementor.openSession()

        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

Examples of org.hibernate.engine.spi.SessionFactoryImplementor.openSession()

        throw new LazyInitializationException( "could not initialize proxy - no Session" );
      }
      try {
        SessionFactoryImplementor sf = (SessionFactoryImplementor)
            SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
        SessionImplementor session = (SessionImplementor) sf.openSession();
       
        // TODO: On the next major release, add an
        // 'isJTA' or 'getTransactionFactory' method to Session.
        boolean isJTA = session.getTransactionCoordinator()
            .getTransactionContext().getTransactionEnvironment()
View Full Code Here

Examples of org.hibernate.engine.spi.SessionFactoryImplementor.openSession()

      throwLazyInitializationException( "SessionFactory UUID not known to create temporary Session for loading" );
    }

    final SessionFactoryImplementor sf = (SessionFactoryImplementor)
        SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
    return (SessionImplementor) sf.openSession();
  }

  protected Boolean readIndexExistence(final Object index) {
    if ( !initialized ) {
      final Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
View Full Code Here

Examples of org.sonar.core.persistence.MyBatis.openSession()

  CoverageService service;

  @Before
  public void setUp() throws Exception {
    MyBatis myBatis = mock(MyBatis.class);
    when(myBatis.openSession(false)).thenReturn(session);
    service = new CoverageService(myBatis, measureDao, snapshotPerspectives);
  }

  @Test
  public void check_permission() throws Exception {
View Full Code Here

Examples of org.sonar.server.db.DbClient.openSession()

  ComponentDto project;

  @Before
  public void setUp() throws Exception {
    DbClient dbClient = mock(DbClient.class);
    when(dbClient.openSession(false)).thenReturn(session);
    when(dbClient.componentDao()).thenReturn(componentDao);
    when(dbClient.resourceDao()).thenReturn(resourceDao);
    when(dbClient.propertiesDao()).thenReturn(propertiesDao);
    when(dbClient.measureDao()).thenReturn(measureDao);
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.svn.SVNSSHSession.SSHConnectionInfo.openSession()

                    SVNErrorManager.cancel("authentication cancelled", SVNLogType.NETWORK);
                } else if (connection == null) {
                    SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED, "Can not establish connection to ''{0}''", realm), SVNLogType.NETWORK);
                }
                try {
                    mySession = connection.openSession();
                    SVNAuthentication author = authManager.getFirstAuthentication(ISVNAuthenticationManager.USERNAME, realm, repository.getLocation());
                    if (author == null) {
                        SVNErrorManager.cancel("authentication cancelled", SVNLogType.NETWORK);
                    }
                    String userName = author.getUserName();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.