Hi All,
If I want to solve my concurrency problems where I want one operation to finish before the other one can proceed is it "safe" todo something like this (regarding locking the object). Pretending I was using it wisely, when is the lock released ?
public void saveUser(User user) throws DAOException
{
Session session = null;
Transaction tx = null;
try
{
session = sessionFactory.openSession();
tx = session.beginTransaction();
session.lock(user,LockMode.WRITE);
etc
public void dleteUser(User user) throws DAOException
{
Session session = null;
Transaction tx = null;
try
{
session = sessionFactory.openSession();
tx = session.beginTransaction();
session.lock(user,LockMode.WRITE);
etc
/Tom
|