Package org.hibernate.cfg

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


        props.putAll(db.getCreationOptions());
        conf.addProperties(props);
       
        // Create session factory
        try {
            _sessionFactory = conf.buildSessionFactory();
        }
        catch (HibernateException e) {
            throw new WGInvalidDatabaseException("Error creating session factory: " + e.getMessage(), e);
        }
View Full Code Here


            Environment.verifyProperties(properties);
            ConfigurationHelper.resolvePlaceHolders(properties);

            // build the serviceregistry
            StandardServiceRegistryBuilder registry = new StandardServiceRegistryBuilder().applySettings(properties);
            sessionFactory = configuration.buildSessionFactory(registry.build());
        } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
View Full Code Here

            Environment.verifyProperties(properties);
            ConfigurationHelper.resolvePlaceHolders(properties);

            // build the serviceregistry
            StandardServiceRegistryBuilder registry = new StandardServiceRegistryBuilder().applySettings(properties);
            sessionFactory = configuration.buildSessionFactory( registry.build());

        } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
View Full Code Here

            Environment.verifyProperties(properties);
            ConfigurationHelper.resolvePlaceHolders(properties);

            StandardServiceRegistryBuilder registry = new StandardServiceRegistryBuilder().applySettings(properties);
            sessionFactory = configuration.buildSessionFactory( registry.build());

            // build metamodel
            SessionFactoryImplementor sfi = (SessionFactoryImplementor) sessionFactory;
            MetamodelImpl.buildMetamodel(configuration.getClassMappings(), sfi);
View Full Code Here

            Environment.verifyProperties(properties);
            ConfigurationHelper.resolvePlaceHolders(properties);

            // build the serviceregistry
            StandardServiceRegistryBuilder registry = new StandardServiceRegistryBuilder().applySettings(properties);
            sessionFactory = configuration.buildSessionFactory(registry.build());

            // build metamodel
            SessionFactoryImplementor sfi = (SessionFactoryImplementor) sessionFactory;
            MetamodelImpl.buildMetamodel(configuration.getClassMappings(), sfi);
View Full Code Here

            Environment.verifyProperties(properties);
            ConfigurationHelper.resolvePlaceHolders(properties);

            // build the serviceregistry
            StandardServiceRegistryBuilder registry = new StandardServiceRegistryBuilder().applySettings(properties);
            sessionFactory = configuration.buildSessionFactory(registry.build());
        } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed
            System.err.println("Initial SessionFactory creation failed." + ex);
            // ex.printStackTrace();
            throw new ExceptionInInitializerError(ex);
        }
View Full Code Here

            Environment.verifyProperties(properties);
            ConfigurationHelper.resolvePlaceHolders(properties);

            // build the serviceregistry
            StandardServiceRegistryBuilder registry = new StandardServiceRegistryBuilder().applySettings(properties);
            sessionFactory = configuration.buildSessionFactory(registry.build());

        } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed
            System.err.println("Initial SessionFactory creation failed." + ex);
            // ex.printStackTrace();
            throw new ExceptionInInitializerError(ex);
View Full Code Here

            Environment.verifyProperties(properties);
            ConfigurationHelper.resolvePlaceHolders(properties);

            // build the serviceregistry
            StandardServiceRegistryBuilder registry = new StandardServiceRegistryBuilder().applySettings(properties);
            sessionFactory = configuration.buildSessionFactory(registry.build());

        } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
View Full Code Here

      try{
        Configuration cfg = new Configuration().configure("hibernate.cfg.xml");  
        StandardServiceRegistryBuilder sb = new StandardServiceRegistryBuilder();
        sb.applySettings(cfg.getProperties());
        StandardServiceRegistry standardServiceRegistry = sb.build();            
        sessionFactory = cfg.buildSessionFactory(standardServiceRegistry);
        sr = standardServiceRegistry;
      } catch (Throwable ex) {
        System.err.println("Failed to create sessionFactory object." + ex);
        throw new ExceptionInInitializerError(ex);
      }
View Full Code Here

    try {
      Configuration cfg = new Configuration().configure("hibernate.cfg.xml");  
      StandardServiceRegistryBuilder sb = new StandardServiceRegistryBuilder();
      sb.applySettings(cfg.getProperties());
      StandardServiceRegistry standardServiceRegistry = sb.build();            
       sessionFactory = cfg.buildSessionFactory(standardServiceRegistry);
    } catch (Throwable ex) {
      System.err.println("Failed to create sessionFactory object." + ex);
      throw new ExceptionInInitializerError(ex);
    }
    System.out.println("Hibernate One to Many Mapping Example Using XML ");
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.