JDBC exception on Hibernate data access


.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [insert into tb_news (n_title, n_content, n_style, n_addTime, n_addAdmin, n_isPublish, n_publishTime, n_publishAdmin, n_updateTime, n_updateAdmin, n_location, n_isShield, n_shieldTime, n_shieldReason, n_shieldAdmin, n_deleteAdmin, n_deleteTime, n_clickNum, n_url, n_isDelete, t_id, n_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; SQL state [72000]; error code [1461]; Could not execute JDBC batch update; nested exception is org.hibernate.QueryTimeoutException: Could not execute JDBC batch update
 org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:645)
 org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:793)

 

出现问题的原因是无法执行更新语句,

   可能情况

   1  数据库字段的长度被限制了,更新的时候数据长度超过数据的长度,测试方法可以在访问的方法加入try catch块,可以清楚的看到异常原因

   2  数据库中不为空的字段被插入空字段。仔细检查从页面传递的参数是否正确接受,以及插入的数据是否违背了数据库字段的约束

你可能感兴趣的:(javaweb)