hibernate struts2 spring 保存和修改时报出 org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.zzl.student.dao.impl.DepartmentDAOImpl.save(DepartmentDAOImpl.java:52)
at com.zzl.student.service.impl.DepartmentServiceImpl.save(DepartmentServiceImpl.java:20)
at com.zzl.student.db.main.Dbru.findBySql_Access(Dbru.java:77)
at com.zzl.student.db.main.Dbru.main(Dbru.java:31)
Caused by: java.sql.BatchUpdateException: ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值 at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8738)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
... 11 more

解决方案 »

  1.   

    因为Hibernate Tools(或者Eclipse本身的Database Explorer)生成*.hbn.xml工具中包含有catalog="***"(*表示数据库名称)这样的属性,将该属性删除就可以了
      

  2.   

    2楼,不是的。我的*.hbn.xml没有包含有catalog="***",我用的是oracle数据库。
      

  3.   

    你一个Long的列 想要插入汉字?
      

  4.   

    http://xuebin530.blog.163.com/blog/static/3772147200972731915975/这里有个例子 ,你可以看看,看能否对你有帮助!
      

  5.   

    1. Oracle给的解决方案(这是针对单纯的Oracle的解决方法)  ORA-02291 integrity constraint (string.string) violated - parent key not found Cause: A foreign key value has no matching primary key value.(原因:外键值没有匹配的主键值与它匹配) Action: Delete the foreign key or add a matching primary key.(解决:删除外键关联或者添加一个和外键匹配的主键值) 2.在本项目中的解决办法:在插入数据的时候,因为其它为日期类型的列的值没有正确的插入,引起的!把其它为日期类型的列值正确匹配后好了!这是我项目中的一种情况!其它的情况大家一起来总结呀!!看看这个是否能给你提示。
      

  6.   

    本应该插入类型为Long的值,你插入成别的类型的了。。