The synchronized keyword in Java allows you to protect an object from 
concurrent access.but how to protect an object from concurrent access in EJB3.0?
for example:
a Stateless EJB access a Entity Instance.
@Stateless
  | @Local(AirlineManager.class)
  | public class AirlineManagerBean implements AirlineManager {
  |     ........
  | 
  |      public boolean update(UpdateBean airline) {
  |           ...........
  |           try {
  |               Airline ca = em.find(Airline.class, "HK");
  |               ..........
  |               em.merge(ca);
  |               ...........
  |          } catch(Exception e) {
  |             ..........
  |          }
  |      }
  | 
  | }
When two AirlineManagerBean Instance to update the same Airline Instance("HK") 
at the same time, it throw a Exception about write lock.

IN JBoss 4.0.4RC1 and EJB 3.0 RC5, I can't catch this Exception via try-catch 
keyword. 

How to protect this complexion:
At the same time, one want to update "HK" Airline instance's field "SeatID" to 
"17A", another one want to update the same "HK" Airline instance's field 
"BaggageID" to "NG54278". How to solve this clash.

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to