Hi all together,
I try to build up a little WebStart Client with two databases (local and remote), both with Hibernate Access. Now i try to create a little syncronize mechanism, for this reason i play a little bit around with the different persists-Methods of the hibernate session, and running into errors with the following code snipped:
Code:
public void saveData(List lst) {
Session session=sessionFactory.openSession();
session.getTransaction().begin();
for (Object e:lst){
session.saveOrUpdate(e);
}
session.getTransaction().commit();
session.close();
}
The "lst"-Parameter is a list of changed objects in local database, which should be inserted or updated into the remote database:
Code:
07.09.2009 14:16:15 org.hibernate.jdbc.BatchingBatcher doExecuteBatch
SCHWERWIEGEND: Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
my search for this error code bring up the fact, that this error appears if the database can't find the Object which should be edit. But that is for me a little bit strange, in my opinion i use "saveOrUpdate" exactly for this reason: if the object exists -> update, if not -> insert, but that maybe seems a misunderstanding?
Any Ideas?
Thanks for help
Dom