org.hibernate.HibernateException: connnection proxy not usable after transaction completion

今天yuan男神的程序报了这个错,

1 getHibernateTemplate().saveOrUpdate(obj);
2 getHibernateTemplate().flush();
3 getHibernateTemplate().refresh(obj);

在第2行报的:

org.hibernate.HibernateException: connnection proxy not usable after transaction completion

以为是hibernate事务的问题,还考虑了懒加载的原因,后来男神发现,是数据库的字段类型为int,实体类的字段类型是Date,这个字段应该是date类型的,save的时候也存放的是date类型,男神把库里的类型改成日期了,就OK啦。

原文地址:https://www.cnblogs.com/mySummer/p/5302248.html