Hey,

I have the following problem.

I need to create a new EntityManagerFactory and rebind it to the JNDI:

EntityManagerFactory emf = new Ejb3Configuration().setProperty(
  | "hibernate.connection.datasource", "java:/DefaultDS").setProperty(
  | "hibernate.hbm2ddl.auto", "create").setProperty("hibernate.show_sql", 
"true")
  | .addAnnotatedClass(Hotel.class).addAnnotatedClass(Room.class)
  | .buildEntityManagerFactory();
  | new InitialContext().rebind("java:/sample3", emf);

I need that this code will be thread safe, because i dont want that 2 threads 
simultaneously will create the same EntityManagerFactory .

How can I do it in a stateless?

Thank you


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048923#4048923

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048923
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to