Quote:
But i found that the data will be in the table after the button is clicked only for a moment
Hi,
As you mentioned above, the data is there for a moment. I guess your are not using HSQLDB (
http://hsqldb.org with the in memmory connection.
The possible scenario is you are getting an Excpetion which is being digested ( swalloed) by Spring Framework. So you should catch the exception and see what is the problem; there is a possiblity that an exception is happening and the database is rolledback.
so the best thing is to report it to the standard outputStream or a File
In this way, you can know what is the problem.
Code:
public void saveChangeCase(final ChangeCase changeCase)
{
HibernateTemplate template = getHibernateTemplate();
template.execute(
new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException
{
try {
tx = session.beginTransaction();
session.saveUpdate(changeCase);
tx.commit();
}catch(HibernateException hiEx) {
if(tx != null) {
try {
tx.rollback();
}catch(HibernateException ex) {
ex.printStackTrace();
throw ex;
}
throw hiEx;
}
}finally {
try {
session.close();
}catch(HibernateException ex) {
ex.printStackTrace();
throw ex;
}
}
}
}
);
}
The other possible scneario which I can see is in the hibernate configuration file with the propperty for autocommit
<property name="connection.autocommit">true</property>
]