Examples of buildSessionFactory()


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

  public void testExplicitPropertyAccessAnnotationsOnField() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.addAnnotatedClass( Course4.class );
    cfg.addAnnotatedClass( Student.class );
    try {
      cfg.buildSessionFactory();
      fail( "@Id and @OneToMany are not placed consistently in test entities. SessionFactory creation should fail." );
    }
    catch ( MappingException e ) {
      // success
    }
View Full Code Here

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

   */
  private Hibernate(String cfg_path){
    sessions = new ThreadLocal();
    transactions = new ThreadLocal();
    Configuration cfg = new Configuration().configure(new File(cfg_path));     
    sessionFactory = cfg.buildSessionFactory();
    this.hibernate_cfg = cfg_path;
  }

  /**
   * ���ض�Ӧ��Hibernate�����ļ���·��
 
View Full Code Here

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

            // set audit interceptor that traces lastChanged
            cfg.setInterceptor(new AuditInterceptor());
            cfg.setProperties(getConnectionProperties());

            sessionFactory = cfg.buildSessionFactory();
            registerStatisticsServiceAsMBean(sessionFactory);
            try {
              String lev = "n/a";
              session = sessionFactory.openSession();
              int iso = session.connection().getTransactionIsolation();
View Full Code Here

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

      }

      sessionFactoryProperties = new Properties(cfg.getProperties());
     
      // Generate sf....
      sessionFactory = cfg.buildSessionFactory();

      try
      {
         // Handle stat-mbean creation/registration....
         if ( controller != null && sessionFactory.getStatistics() != null && sessionFactory.getStatistics().isStatisticsEnabled() )
View Full Code Here

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

    setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider").
    setProperty("hibernate.hbm2ddl.auto", "create-drop").
    setProperty("hibernate.show_sql", "true").
    addClass(HourOfDayStat.class);

    HibernateUtil.setSessionFactory(config.buildSessionFactory());
   
    // uncomment the following if you want to launch a the dbmanager gui (while debugging through this class probably)
/*    Runnable r = new Runnable() {
      @Override
      public void run() {
View Full Code Here

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

    setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider").
    setProperty("hibernate.hbm2ddl.auto", "create-drop").
    setProperty("hibernate.show_sql", "true").
    addClass(DayOfWeekStat.class);

    HibernateUtil.setSessionFactory(config.buildSessionFactory());
   
    // uncomment the following if you want to launch a the dbmanager gui (while debugging through this class probably)
/*    Runnable r = new Runnable() {
      @Override
      public void run() {
View Full Code Here

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

    setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider").
    setProperty("hibernate.hbm2ddl.auto", "create-drop").
    setProperty("hibernate.show_sql", "true").
    addClass(DailyStat.class);

    HibernateUtil.setSessionFactory(config.buildSessionFactory());
   
    // uncomment the following if you want to launch a the dbmanager gui (while debugging through this class probably)
/*    Runnable r = new Runnable() {
      @Override
      public void run() {
View Full Code Here

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

    setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider").
    setProperty("hibernate.hbm2ddl.auto", "create-drop").
    setProperty("hibernate.show_sql", "true").
    addClass(WeeklyStat.class);

    HibernateUtil.setSessionFactory(config.buildSessionFactory());
   
    // uncomment the following if you want to launch a the dbmanager gui (while debugging through this class probably)
/*    Runnable r = new Runnable() {
      @Override
      public void run() {
View Full Code Here

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

   */
  private void tryBoot(String configurationResourceName) {
    Configuration cfg = new OgmConfiguration();
    cfg.setProperty( OgmProperties.DATASTORE_PROVIDER, "infinispan" );
    cfg.setProperty( InfinispanProperties.CONFIGURATION_RESOURCE_NAME, configurationResourceName );
    SessionFactory sessionFactory = cfg.buildSessionFactory();
    if ( sessionFactory != null ) {
      try {
        // trigger service initialization, and also verifies it actually uses Infinispan:
        InfinispanTestHelper.getProvider( sessionFactory );
      }
View Full Code Here

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

    url = url.replace("//localhost:3306/", "//" + rc.getProperty("dbhost") + ":" + rc.getProperty("dbport") + "/");
    configuration.setProperty("hibernate.connection.url", url);
    configuration.addAnnotatedClass(World.class);
    configuration.addAnnotatedClass(Fortune.class);
    ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder().applySettings(configuration.getProperties());
    return configuration.buildSessionFactory(serviceRegistryBuilder.buildServiceRegistry());
  }
}
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.