Examples of buildSessionFactory()


Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

  protected SessionFactory buildSessionFactory() {
    Class<?>[] classes = getConfiguredEntityTypes();
    Configuration configuration = createConfiguration( classes );

    return configuration.buildSessionFactory();
  }

  private Class<?>[] getConfiguredEntityTypes() {
    for ( FrameworkMethod frameworkMethod : getTestClass().getAnnotatedMethods( TestEntities.class ) ) {
      Method method = frameworkMethod.getMethod();
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

            configuration.setProperty(AvailableSettings.USE_QUERY_CACHE, "false");
            configuration.setProperty(AvailableSettings.SHOW_SQL, "false");
            configuration.setProperty(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, "thread");
            configuration.addAnnotatedClass(World.class);
            StandardServiceRegistryBuilder serviceRegistryBuilder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
            return configuration.buildSessionFactory(serviceRegistryBuilder.build());
        } catch (RuntimeException ex) {
            LOGGER.error("Failed to create session factory");
            throw ex;
        }
    }
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

   
    if (configuration==null) {
      throw new WireException("couldn't find configuration");
    }
   
    SessionFactory sessionFactory = configuration.buildSessionFactory();
   
    wireContext.addListener(new SessionFactoryCloser(sessionFactory));

    return sessionFactory;
  }
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

            @Override
            public void sessionFactoryClosed(SessionFactory factory) {
                ((StandardServiceRegistryImpl) serviceRegistry).destroy();
            }
        });
        return conf.buildSessionFactory(serviceRegistry);
    }

    /**
     * @return bootstrapServiceRegistry, which is using classloaderService, which is able to find classes from tccl, hibernate
     *         classloader and system classloader
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

    // configure.getEventListeners().setPreUpdateEventListeners(
    // new PreUpdateEventListener[] { new PreUpdateListener() });
    // configure.getEventListeners().setLoadEventListeners(
    // new LoadEventListener[] { new LoadListener(),
    // new DefaultLoadEventListener() });
    final SessionFactory sessionFactory = configure.buildSessionFactory();
    // Session session = sessionFactory.openSession();
    // Transaction transaction = session.beginTransaction();
    // session.createQuery("from Stanowisko").list();
    // Stanowisko s = (Stanowisko) session.load(Stanowisko.class, 1);
    // s.setNazwa(System.currentTimeMillis() + " miro");
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

     * @param servletContext the servlet context
     */
    public void onInit(ServletContext servletContext) {
        Configuration configuration = createConfiguration();
        initConfiguration(configuration);
        sessionFactory = configuration.buildSessionFactory();
    }

    /**
     * Creates and returns a new Configuration instance.
     * <p/>
 
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

                            org.picketlink.idm.api.IdentitySessionFactory.class.getClassLoader());
                    Thread.currentThread().setContextClassLoader(cl);
                    return null;
                }
            });
            return conf.buildSessionFactory(serviceRegistry);
        } finally {
            if (old != null) {
                SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>() {
                    public Void run() {
                        Thread.currentThread().setContextClassLoader(old);
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

      .addClass(Bid.class)
      .addClass(User.class)
      .setProperty(Environment.HBM2DDL_AUTO, "create");
    //cfg.setProperty("hibernate.show_sql", "true");

    test.factory = cfg.buildSessionFactory();

    test.createTestAuctions();
    test.viewAllAuctionsSlow();

    test.viewAllAuctionsFast();
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

  }
 
  private SessionFactory createSimplestSessionFactory() {
    Configuration configuration = new Configuration();
    configuration.setProperty("hibernate.dialect","org.hibernate.dialect.HSQLDialect");
    SessionFactory sessionFactory = configuration.buildSessionFactory();
    return sessionFactory;
  }
 
 
}
View Full Code Here

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()

public class SubclassProxyInterfaceTest extends TestCase {
  public void testSubclassProxyInterfaces() {
        final Configuration cfg = new Configuration()
        .setProperty( Environment.DIALECT, H2Dialect.class.getName() );
    cfg.addClass( Person.class );
    cfg.buildSessionFactory().close();
  }
}
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.