I'm using the following code in order to create a EntityManagerFactory:
Ejb3Configuration cfg = new Ejb3Configuration();
cfg.addProperties(map);
cfg.addAnnotatedClass(Subnet.class);
cfg.addAnnotatedClass(Device.class);
EntityManagerFactory factory = cfg.createEntityManagerFactory();
//The map includes the following properties:
p.put("hibernate.transaction.manager_lookup_class",
"org.hibernate.transaction.JBossTransactionManagerLookup");
p.put("hibernate.dialect",
"org.hibernate.dialect.MySQLDialect");
p.put("hibernate.show_sql",
"true");
p.put("hibernate.cache.provider_class",
"org.hibernate.cache.HashtableCacheProvider");
p.put("hibernate.jndi.java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
p.put("hibernate.jndi.java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
p.put("hibernate.bytecode.use_reflection_optimizer",
"false");
p.put("hibernate.bytecode.provider",
"javassist");
p.put("hibernate.connection.driver_class",
"com.mysql.jdbc.Driver");
p.put("hibernate.connection.username",
"root");
p.put("hibernate.connection.password",
"root");
p.put("hibernate.connection.url",
"jdbc:mysql://localhost:3306/"+plan);
p.put("hibernate.max_fetch_depth",
"3");
p.put("javax.persistence.transactionType",
"JTA");
My problem is that the created factory is with PersistenceContextType EXTENDED.
What should I do in order to make it of type TRANSACTION?
Thanks,
Eyal Adi
|