Hmmm... more specifically:
If I had an AtmServlet similar to that shown in example 5.5 of http://www.unix.org.ua/orelly/java-e...t/ch05_05.htm; but retrieved the Account act variable from a DAO using HibernateTemplate....
1) Would the act variable contain the same object reference across multiple threads?
2) If (1)==true, I'm guessing I'd still need to synchronize access in the following lines?:
Code:
synchronized(act) {
if(req.getParameter("WITHDRAW") != null) && (amt < act.balance)
act.balance = act.balance - amt;
if(req.getParameter("DEPOSIT") != null) && (amt > 0)
act.balance = act.balance + amt;
} // end synchronized block
3) If (1)==false, how would conflicting concurrent changes be resolved when writing threads commit transactions?
Thanks.
Craig