Fórum UNIDADE DE PERSISTÊNCIA COM VALORES DINAMICOS #497604
13/10/2014
0
John Lima
Curtir tópico
+ 0Posts
13/10/2014
Ronaldo Lanhellas
Gostei + 0
13/10/2014
John Lima
Gostei + 0
13/10/2014
Ronaldo Lanhellas
public static EntityManager createEntityManager() {
Properties properties = new Properties();
properties.put("javax.persistence.provider", "org.hibernate.ejb.HibernatePersistence");
properties.put("javax.persistence.transactionType", "RESOURCE_LOCAL");
properties.put("hibernate.connection.username", "sa");
properties.put("hibernate.connection.password" ,"");
properties.put("hibernate.connection.driver_class","org.hsqldb.jdbcDriver");
properties.put("hibernate.connection.url", "jdbc:hsqldb:." );
properties.put("hibernate.dialect" ,"org.hibernate.dialect.HSQLDialect");
properties.put("hibernate.hbm2ddl.auto","create-drop");
properties.put("hibernate.show_sql","true");
properties.put("hibernate.format_sql" ,"true");
//
Ejb3Configuration cfg = new Ejb3Configuration();
cfg.addProperties(properties);
cfg.addAnnotatedClass(City.class);
cfg.addAnnotatedClass(LocalCustomer.class);
//
EntityManagerFactory factory = cfg.buildEntityManagerFactory();
return factory.createEntityManager();
}
Gostei + 0
13/10/2014
John Lima
Gostei + 0
13/10/2014
Ronaldo Lanhellas
Gostei + 0
13/10/2014
John Lima
Gostei + 0
13/10/2014
Ronaldo Lanhellas
Tenta adicionar a seguinte propriedade:
properties.put("hibernate.archive.autodetection", "class,hbm");
Gostei + 0
13/10/2014
John Lima
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)