JBoss uses EnityManager which is involved with TransactioManager and em is 
proxy so em.find/em.save is thread safe.

Your code is also thread safe because beans are thread-safe but creating 
emtnity manager factory has high cost (6 seconds on my machine). 

Persistence.createEntityManagerFactory("em");

Should be invkoned once.

If you move creating emf to singleton then there is question if 
emf.createEntityManager(); has proper transaction if you are using annotations 
on beans. If you using transactional filter (eg. on web.xml in web apps) which 
global begin/commit transaction there should be no problem.

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

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

Reply via email to