Package org.hibernate.cfg

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


      System.err
          .println( "Loaded serializable configuration:" + ( System.currentTimeMillis() - start ) / 1000.0 + " sec." );
    }
    start = System.currentTimeMillis();
    System.err.println( "Start build of session factory" );
    SessionFactory factory = cfg.buildSessionFactory();
    System.err.println( "Build session factory:" + ( System.currentTimeMillis() - start ) / 1000.0 + " sec." );
    return factory;
  }

  public void generateTestFiles() throws Throwable {
View Full Code Here


    configuration.buildMappings();

    applyCacheSettings( configuration );
    settings.afterConfigurationBuilt( configuration.createMappings(), getDialect() );

    SessionFactory sessionFactory = configuration.buildSessionFactory();
    this.configuration = configuration;
    this.sessionFactory = sessionFactory;

    settings.afterSessionFactoryBuilt( ( SessionFactoryImplementor ) sessionFactory );
  }
View Full Code Here

        props.load(is);
        ServiceRegistry serviceRegistry = new ServiceRegistryBuilder()
            .applySettings(props)
            .build();
        cfg.setProperties(props);
        sessionFactory = cfg.buildSessionFactory(serviceRegistry);
        session = sessionFactory.openSession();
        session.beginTransaction();
    }

    private void shutdown() {
View Full Code Here

    private static SessionFactory buildSessionFactory(HibernateConfiguration hibernateCfg)
    {
        Configuration nativeCfg = toNativeHibernateConfiguration(hibernateCfg);
        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
        builder.applySettings(nativeCfg.getProperties());
        return nativeCfg.buildSessionFactory(builder.buildServiceRegistry());
    }
   
    private static Configuration toNativeHibernateConfiguration(HibernateConfiguration hibernateCfg)
    {
        Configuration cfg = new Configuration();
View Full Code Here

          }
        }
      }
      configuration.configure(configurationDocument);
      configuration.addProperties(frameworkConfiguration.getProperties());
      sessionFactory = configuration.buildSessionFactory();
      cachedSessionFactories.put(additionalConfigurationPath, sessionFactory);
      return sessionFactory;
    } catch (ParserConfigurationException e) {
      throw new RuntimeException("invalid DOM parser configuration",e);
    } catch (SAXException e) {
View Full Code Here

        sessionFactoryElem.addContent(prop);
       
        Configuration config = new Configuration();
        DOMOutputter outputter = new DOMOutputter();
        config.configure(outputter.output(configDoc));
        this.sessionFactory = config.buildSessionFactory();
    }
   
    /**
     * Construct self using Hibernate config resource and optional dialect.
     * @param configResouce Classpath-based path to Hibernate config file (e.g. "/hibernate.cgf.xml")
View Full Code Here

        sessionFactoryElem.addContent(prop);
       
        Configuration config = new Configuration();
        DOMOutputter outputter = new DOMOutputter();
        config.configure(outputter.output(configDoc));
        this.sessionFactory = config.buildSessionFactory();
    }
   
   
    /**
     * Get persistence session on current thread.
View Full Code Here

  public SessionFactory getSessionFactory(Document configurationDocument) {
    Configuration cfg;
    try {
      cfg = new Configuration().configure(new DOMWriter().write(configurationDocument));
      sessionFactory = cfg.buildSessionFactory();
    } catch (HibernateException e) {
      Logger.log(e);
    } catch (DocumentException e) {
      Logger.log(e);
    }
View Full Code Here

        // setup config
        Configuration cfg = new Configuration().configure(new DOMWriter().write(document));
        // add object mappings
        Logger.log(mappingDocument.asXML());
        cfg.addDocument(new DOMWriter().write(mappingDocument));
        sessionFactory = cfg.buildSessionFactory();
      } catch (Exception e) {
        Logger.log(e);
      }
    }
    return sessionFactory;
View Full Code Here

 
    Configuration configuration = new Configuration();
    configuration.configure();
    ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(
            configuration.getProperties()).buildServiceRegistry();
    sessionFactory = configuration.buildSessionFactory(serviceRegistry);
  }
 
  /**
   * Abre una nueva sesi�n
   */
 
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.