-
1. Re: Concurrency/CMP 2.x problem in Jboss
scoy Feb 13, 2003 7:24 AM (in response to belakdar)Hi,
This is why they invented transactions.
You need to learn about EJB transactions and commit options.
Typically, you would code your "business interface" in a session bean, and give the method a trx attribute of "Requires New". The session bean method then performs all activities on the entity bean within the scope of a single transaction.
Good luck,
Steve -
2. Re: Concurrency/CMP 2.x problem in Jboss
belakdar Feb 17, 2003 3:21 AM (in response to belakdar)Thanks for your reply.
Before writing my question I read all aspects concerning transactions.
I tried in the past a same as you said (I mean with stateless session beans) but unfortunately it does work.
I think what I need is an optimistic concurrency like the one supported in weblogic server and the most important data base servers like the one I'm using (Postgres uses multi-versionning appoach where writes don't block reads and reads don't block writes).
Regards,
Omar. -
3. Re: Concurrency/CMP 2.x problem in Jboss
steinarc Feb 17, 2003 3:33 AM (in response to belakdar)Locking is performed within JBoss. Upon entering the method, the entity ben is locked.
Once the method call has finished, the TX is completed and other EJBs are allowed access to the same entity bean.
Using "for...update" is really only usefull if you are accessing the same database from some other non-jboss application. In which case you must change you commit-option to either B or C.