try{
hibernateTemplate.save(commit);
}catch(Exception e){
System.out.println(e.getStackTrace());
}
我改成这样就可以了 不知道为什么

解决方案 »

  1.   

    public Serializable save(final Object entity) throws DataAccessException {   
           return executeWithNativeSession(new HibernateCallback<Serializable>() {   
                public Serializable doInHibernate(Session session) throws HibernateException {   
                   checkWriteOperationAllowed(session);   
                  return session.save(entity);   
               }   
          });   
     }   save方法有异常,不知道你怎么编译过的。