Package org.hibernate

Examples of org.hibernate.SessionFactory$SessionFactoryOptions


         throw new JpaStoreException(
               "Entity class has one identifier, but it must not have @GeneratedValue annotation");
      }

      // Hack: MySQL needs to have fetchSize set to Integer.MIN_VALUE in order to do streaming
      SessionFactory sessionFactory = emf.createEntityManager().unwrap(Session.class).getSessionFactory();
      if (sessionFactory instanceof SessionFactoryImplementor) {
         Dialect dialect = ((SessionFactoryImplementor) sessionFactory).getDialect();
         if (dialect instanceof MySQLDialect) {
            setFetchSizeMinInteger = true;
         }
View Full Code Here


      this.remoteListener = new CacheAccessListener();
      remoteCache.addCacheListener(remoteListener);     
     
      TransactionManager remoteTM = remoteCache.getConfiguration().getRuntimeConfig().getTransactionManager();
     
      SessionFactory localFactory = getEnvironment().getSessionFactory();
      SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();
     
      ClassLoaderTestDAO dao0 = new ClassLoaderTestDAO(localFactory, localTM);     
      ClassLoaderTestDAO dao1 = new ClassLoaderTestDAO(remoteFactory, remoteTM);
     
      // Determine whether our query region is already there (in which case it
View Full Code Here

   {
      // First session factory uses a cache
      CacheManager localManager = TestCacheInstanceManager.getTestCacheManager(DualNodeTestUtil.LOCAL);
      this.localCache = localManager.getCache(getEntityCacheConfigName(), true);     
      TransactionManager localTM = localCache.getConfiguration().getRuntimeConfig().getTransactionManager();
      SessionFactory localFactory = getEnvironment().getSessionFactory();
     
      // Second session factory doesn't; just needs a transaction manager
      TransactionManager remoteTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestUtil.REMOTE);
      SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();
     
      ClassLoaderTestDAO dao0 = new ClassLoaderTestDAO(localFactory, localTM);     
      ClassLoaderTestDAO dao1 = new ClassLoaderTestDAO(remoteFactory, remoteTM);
     
      Integer id = new Integer(1);
View Full Code Here

      MyListener remoteListener = new MyListener();
      remoteCache.addCacheListener(remoteListener);     
     
      TransactionManager remoteTM = remoteCache.getConfiguration().getRuntimeConfig().getTransactionManager();
     
      SessionFactory localFactory = getEnvironment().getSessionFactory();
      SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();
     
      try
      {
         System.out.println("Create node 0");
         IdContainer ids = createCustomer(localFactory, localTM);
View Full Code Here

            conf_.addURL(url);
        }

        sessionFactory_ = SecurityHelper.doPrivilegedAction(new PrivilegedAction<SessionFactory>() {
            public SessionFactory run() {
                SessionFactory factory = conf_.configure().buildSessionFactory();
                return factory;
            }
        });
    }
View Full Code Here

  @Override
  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

  @Override
  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

  @Override
  public void purge(String entity) {
    Class<?> clazz = getEntityClass( entity );

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

                    cfg.addAnnotatedClass(clazz);
                }
            }
        });

        final SessionFactory sessionFactory = cfg.buildSessionFactory();

        Provider<Session> sessionProvider = new Provider<Session>() {
            public Session get() {
                return sessionFactory.openSession();
            }
        };
        Provider<SessionFactory> sessionFactoryProvider = new Provider() {
            public Object get() {
                return sessionFactory;
View Full Code Here

    LOG.trace( "Resolving serialized SessionFactory" );
    return locateSessionFactoryOnDeserialization( uuid, name );
  }

  private static SessionFactory locateSessionFactoryOnDeserialization(String uuid, String name) throws InvalidObjectException{
    final SessionFactory uuidResult = SessionFactoryRegistry.INSTANCE.getSessionFactory( uuid );
    if ( uuidResult != null ) {
      LOG.debugf( "Resolved SessionFactory by UUID [%s]", uuid );
      return uuidResult;
    }

    // in case we were deserialized in a different JVM, look for an instance with the same name
    // (provided we were given a name)
    if ( name != null ) {
      final SessionFactory namedResult = SessionFactoryRegistry.INSTANCE.getNamedSessionFactory( name );
      if ( namedResult != null ) {
        LOG.debugf( "Resolved SessionFactory by name [%s]", name );
        return namedResult;
      }
    }
View Full Code Here

TOP

Related Classes of org.hibernate.SessionFactory$SessionFactoryOptions

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.