Ejb3Configuration ejbconf = new Ejb3Configuration();
ejbconf.setProperty("hibernate.connection.datasource", "java:/" + datasourceName);
ejbconf.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect");
ejbconf.setProperty("hibernate.show_sql", "false");
ejbconf.setProperty("hibernate.ejb.naming_strategy","com.fcl.greenfield.naming.FCLNamingStrategy");
ejbconf.setProperty("hibernate.hbm2ddl.auto", "update");
Usando :
Logger.info("Building SessionFactory");
EntityManagerFactory emf = ejbconf.createEntityManagerFactory();
EntityManager em = emf.createEntityManager();
Facil né ? ! aeuUAEhuaehuaheuHEuae
Sem mais !