I just think this is interesting, after running a period of time, some time my Progam will throw out following exception, in my code there is nothing special, following is my code:
public void saveData(List data)
{
if(data==null || data.isEmpty())
return;
try
{
getHibernateTemplate().saveOrUpdateAll(data);
}catch (Throwable t)
{
t.printStackTrace();
}
}
but it will throw out following exception:
2006-04-09 22:13:10,156 [org.hibernate.event.def.AbstractFlushingEventListener] - Could not synchronize database state with session
[INFO] org.hibernate.exception.ConstraintViolationException: could not insert: [com.stonewatercontrols.model.data.Datapoint5minutesdata]
[INFO]
.................
org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdateAll(HibernateTemplate.java:690)
[INFO] at com.stonewatercontrols.dao.hibernate.DataDaoHibernate.saveData(DataDaoHibernate.java:52)
......
this issue is from pk duplicatie or constrain violation, but this is not the case for my program, since I log out the value for the pk or unique constrain , they are OK,
and it seems that this issue is also from buffered insert, I am not sure if this is a bug of hibernate or spring.
this issue is not repeatable , so I don't think this is from my code(see above), my code is very simple, no any specail thing there.
any advise will be appreciated.
Thanks
Jack
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: