List of usage examples for org.hibernate.cfg Configuration buildSessionFactory
public SessionFactory buildSessionFactory() throws HibernateException
From source file:br.com.cssistemas.dados.HibernateUtil.java
private static SessionFactory buildSessionFactory() { try {//from w w w. j a va 2 s .c o m Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); return cfg.buildSessionFactory(); } catch (HibernateException erro) { System.out.println("A criao inicial do SessionFactory Falhou. Erro" + erro); throw new ExceptionInInitializerError(erro); } }
From source file:br.com.loja.framework.hibernate.HibernateUtil.java
private static SessionFactory buildSessionFactory() { try {/* ww w. j a v a 2 s . c o m*/ // Create the SessionFactory from hibernate.cfg.xml Configuration configuration = new Configuration(); configuration.configure("hibernate.cfg.xml"); return configuration.buildSessionFactory(); } catch (Exception ex) { // Make sure you log the exception, as it might be swallowed throw new RuntimeException("Falhar ao iniciar configuracao de acesso ao banco de dados", ex); } }
From source file:br.com.magmadoctor.util.HibernateUtil.java
private static SessionFactory buildSessionFactory() { try {/* ww w . j av a2 s. c o m*/ Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); return cfg.buildSessionFactory(); //return cfg.buildSessionFactory(null); } catch (Throwable e) { System.out.println("Criao inicial do objeto SessionFactory falhou. Erro: " + e); throw new ExceptionInInitializerError(e); } }
From source file:br.com.sales.compra.model.HibernateUtil.java
private static SessionFactory buildSessionFactory() { try {/*from w ww. j a va 2 s. c om*/ Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); return cfg.buildSessionFactory(); } catch (Exception e) { System.out.println(e.getMessage()); throw new ExceptionInInitializerError(); } }
From source file:br.edu.ifpe.garanhuns.ppo.pep.models.persistence.management.DaoManagerHiberRever.java
private DaoManagerHiberRever() { Configuration cfg = new Configuration().configure("hibernate.cfg.xml"); sessionFactory = cfg.buildSessionFactory(); //ver isso depois session = sessionFactory.openSession(); }
From source file:br.edu.ifrs.restinga.modulorh.dao.HibernateUtil.java
public static SessionFactory getSessionFactory() { if (sessionfactory == null) { Configuration ac = new Configuration(); ac.configure();/* ww w . jav a2 s .co m*/ sessionfactory = ac.buildSessionFactory(); } return sessionfactory; }
From source file:br.fgv.dao.FactorySessionHSqlDB.java
License:Open Source License
public FactorySessionHSqlDB() { if (factory == null) { Configuration cfg = new Configuration(); cfg.configure().setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect") .setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:CGU") .setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver") .setProperty("hibernate.connection.username", "sa") .setProperty("hibernate.connection.password", "").setProperty("hibernate.show_sql", "false"); session = cfg.buildSessionFactory().openSession(); }//w ww . ja v a 2 s .co m }
From source file:br.fgv.dao.FactorySessionMySqlDB.java
License:Open Source License
public static Session create() { Session session;/* w w w . ja v a 2s. com*/ Configuration cfg = new Configuration(); cfg.configure().setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect") .setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/consultaTSE?autoReconnect=true") .setProperty("hibernate.connection.driver_class", "org.gjt.mm.mysql.Driver") .setProperty("hibernate.connection.username", "root") .setProperty("hibernate.connection.password", "").setProperty("hibernate.show_sql", "false"); session = cfg.buildSessionFactory().openSession(); return session; }
From source file:ca.myewb.frame.HibernateUtil.java
License:Open Source License
public static void createFactory(String suffix) throws HibernateException { if (!suffix.equals(currentSuffix)) { isBuilding = true;//from w ww . j ava 2 s. c o m currentSuffix = suffix; HibernateUtil.closeSession(); try { // recreate the SessionFactory Configuration config = getConfiguration(suffix); HibernateUtil.sessionFactory = config.buildSessionFactory(); } catch (Throwable ex) { throw new ExceptionInInitializerError(ex); } isBuilding = false; } }
From source file:ch.icclab.cyclops.persistence.HibernateClient.java
License:Open Source License
/** * Constructor * @param conf to be used */ private HibernateClient(Configuration conf) { sessionFactory = conf.buildSessionFactory(); }