Hi,
I have been trying to use the save or update method in hibernate. Here is what has happened so far:
1. I did a
net.sf.hibernate.Session session = HibernateUtil.currentSession();
Transaction transaction = session.beginTransaction();
.......
session.save(sentObject);
which inserts a new row in the DB without problems.
2. I changed the method from session.save() to session.saveOrUpdate(Object).
I get a :
Wed Aug 04 17:45:50 EDT 2004 ERROR [Thread-1] Could not synchronize database state with session
net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)
I have not changed any of the config files between the 2 steps. Can somone please explain as to why this is happening and what I need to correct the issue. I need to update the DB row if the row already exists.
I am using DB2 UDB as the back end DB.
Please help,
-- Kailas
|