Hi,
I've developped two applications
--- Step 1 ---
Database is MySQL with InnoDB table type
I'm using Hibernate 2.1.3
I start both applications
--- Step 2 ---
Application #1
Session session = HibernateUtil.currentSession();
Transaction tx = beginTransaction();
Object obj = new Obj();
session.save(obj);
tx.commit();
HibernateUtil.close();
Application #2
Session session = HibernateUtil.currentSession();
List objectList = session.find( "from Object as object WHERE object.code=(?)", code, Hibernate.STRING);
HibernateUtil.close();
First query succeeded, the new object is well selected
Application #1
Session session = HibernateUtil.currentSession();
Transaction tx = beginTransaction();
Object obj = new Obj();
session.save(obj);
tx.commit();
HibernateUtil.close();
Application #2
Session session = HibernateUtil.currentSession();
List objectList = session.find( "from Object as object WHERE object.code=(?)", code, Hibernate.STRING);
HibernateUtil.close();
Second query failed, the new Object is not found
I suppose it is a concurrency error because of when I execute the same sequence in the same application, it works
What can i do to resolve this error ?
|