for (Record record : recordList) {
record.setName(name[i]);
...
...
session.saveOrUpdate(record);
}
When you have a persisted object and you change a value on it, it becomes dirty and hibernate needs to flush these changes to your persistence layer. So that Hibernate can synchronize the underlying persistent store with persistable state held in memory.
Flush and clean session to fix it, like below.
Check out my site seenuonjava.com for morefor (Record record : recordList) {
record.setName(name[i]);
...
...
session.saveOrUpdate(record);
session.flush();
session.clear();
}
No comments:
Post a Comment