[jboss-user] [EJB 3.0] - persistent object modification by different threads safe?

ppphoenixxx do-not-reply at jboss.com
Thu Aug 10 01:21:37 EDT 2006


Hi,

according to EJB3-Specs a single EntityManager object isn't thread-safe, so the same EntityManager shouldn't be used by different threads: but what about obtaining a set of persistent objects, applying some changes on them in a *different* thread, where no EntityManager methods are called or used?

Well it works, right out of the box: no EntityManager.clear or merge calls needed in the "original" thread - but I have no idea if this is safe, supposed to work or should be avoided at all costs: I only know that I spare myself a little work by not going the usual way to get me another session bean and obtain an entity manager there. 

To give you some details about the application I am writing: Its a standard EJB3 one, with some persistent objects and a built in callback-server which listens in a different thread on a specific network port for connections and should do some persistent operations upon a callback-connection from a client.

Thanks for any input!

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964237



More information about the jboss-user mailing list