Hi,
In our entity bean code which is to be refactored soon, for the time being we are calling the hibernate session methods based on a boolean switch. This was working fine, but recently it started throwing exception when we are trying to insert a record. Looking at the exception, it seems hibernate is trying to locate a corresponding row in DB against the values being passed and failing to do so and hence exception.
our entity bean looks like
e.g AbcEJB extends SessionBean {
boolean flag = true;
public TessObject createTestObject(TestObject data){
if(flag) {
Session ss = HibernateUtility.getSession();
session.saveOrUpdate(data);
session.flush();
return data;
}
...
entityHome = lookupHome();
entityHome.create(x,y,z);
...
...
}
}
The Exception being thrown is
Error: System Error:
javax.transaction.TransactionRolledbackException: EJB Exception: : org.hibernate.HibernateException: Unable to locate row for retrieval of generated properties: [com.abc.pqr.TestObject#component[x,y]{x=VAL1, y=VAL2}]
Please let me know the solution if anyone has come across such an issue.
|