Java异常Could not execute JDBC batch update

org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) ~[hibernate-3.3.2.jar:na]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) ~[hibernate-3.3.2.jar:na]
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) ~[hibernate-3.3.2.jar:na]
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266) ~[hibernate-3.3.2.jar:na]
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:170) ~[hibernate-3.3.2.jar:na]
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) ~[hibernate-3.3.2.jar:na]
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) [hibernate-3.3.2.jar:na]
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028) [hibernate-3.3.2.jar:na]
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366) [hibernate-3.3.2.jar:na]
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137) [hibernate-3.3.2.jar:na]
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656) [spring.orm-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) [spring.transaction-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) [spring.transaction-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393) [spring.transaction-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) [spring.transaction-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring.aop-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) [spring.aop-3.0.5.jar:3.0.5.RELEASE]
at com.sun.proxy.$Proxy21.updateAdmin(Unknown Source) [na:na]
at com.jeecms.cms.action.admin.main.CmsAdminLocalAct.update(CmsAdminLocalAct.java:192) [CmsAdminLocalAct.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.6.0_45]
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) [spring.web-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643) [servlet-api.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) [servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) [spring.orm-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring.web-3.0.5.jar:3.0.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring.web-3.0.5.jar:3.0.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring.web-3.0.5.jar:3.0.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
at com.jeecms.common.web.ProcessTimeFilter.doFilter(ProcessTimeFilter.java:35) [ProcessTimeFilter.class:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.37]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.37]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.37]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:6.0.37]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.37]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) [catalina.jar:6.0.37]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879) [tomcat-coyote.jar:6.0.37]
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617) [tomcat-coyote.jar:6.0.37]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760) [tomcat-coyote.jar:6.0.37]
at java.lang.Thread.run(Unknown Source) [na:1.6.0_45]
Caused by: java.sql.BatchUpdateException: Duplicate entry '863455-186' for key 'PRIMARY'
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2016) ~[mysql-connector-5.1.8.jar:na]
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1452) ~[mysql-connector-5.1.8.jar:na]
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) ~[c3p0-0.9.1.2.jar:0.9.1.2]
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) ~[hibernate-3.3.2.jar:na]
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ~[hibernate-3.3.2.jar:na]
... 52 common frames omitted

5个回答

很明显是出现重复主键,必须保证主键的唯一性

数据有问题吧,Caused by: java.sql.BatchUpdateException: Duplicate entry '863455-186' for key 'PRIMARY'看下这个数据

Caused by: java.sql.BatchUpdateException: Duplicate entry '863455-186' for key 'PRIMARY'

从异常Caused by: java.sql.BatchUpdateException: Duplicate entry '863455-186' for key 'PRIMARY'来看,是说主键重复了,请知悉。

更新的时候你又生成了一个新的对象,主键和已经存在的对象相同了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
求助could not execute jdbc batch update异常
ssh框架,department和user表一对多关系,能插入数据,能删除user数据,再删除department数据时报以下异常rncould not execute jdbc batch update,由于外键约束引起的,求如何解决,在线等
Could not execute JDBC batch update
[color=#FF6600]hibernate.cfg.xml:[/color]rnrnrnrnrnrnhibernate.cfg.xml:rnrn truern swzlxtrn rn jdbc:oracle:thin:@localhost:1521:orclrn rn jiamengyirn 123456rn rn oracle.jdbc.driver.OracleDriverrn rn rn org.hibernate.dialect.Oracle9Dialectrn rn rn rnrnrnrn[color=#FF6600]userinfo.hbm.xml:[/color]rnrnrnrnrn rn rn rn rn SEQ_userrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnpackage com.ssh.dao;rnimport java.util.List;rnimport org.springframework.context.ApplicationContext;rnimport org.springframework.context.support.ClassPathXmlApplicationContext;rnimport org.springframework.orm.hibernate3.support.HibernateDaoSupport;rnimport com.ssh.bean.userinfo;rnpublic class userinfoDao extends HibernateDaoSupportrn @SuppressWarnings("unchecked")rn public List login(userinfo user)rn return getHibernateTemplate().findByExample(user);rn rnrnrn rn public static void main(String[] args) rn ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");rn userinfoDao userdao =(userinfoDao) ctx.getBean("userinfoDao");rn userinfo user=new userinfo();rn user.setName("lulu");rn user.setPassword("123");rn user.setQq(22);rn user.setEmail("340344540@qq.com");rn user.setPhone("13822175291");rn user.setPower(1);rn userdao.addUsers(user);rn rnrnrnrnrn报错:Hibernate: select SEQ_user.nextval from dualrnHibernate: insert into jiamengyi.userinfo (name, password, qq, email, phone, power, userid) values (?, ?, ?, ?, ?, ?, ?)rnlog4j:WARN No appenders could be found for logger (org.hibernate.util.JDBCExceptionReporter).rnlog4j:WARN Please initialize the log4j system properly.rnlog4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.rnCould not execute JDBC batch update; SQL [insert into jiamengyi.userinfo (name, password, qq, email, phone, power, userid) values (?, ?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
Books.hbm.xml 内容:rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnjava 代码内容:rnpublic class Test rnrn public static void main(String[] args) rnrn try rn SessionFactory sf = new Configuration().configure().buildSessionFactory();rn Session session = sf.openSession();rn Transaction tx = session.beginTransaction();rn Books pd = new Books();rn pd.setBookId(1);rn pd.setBookName("教父");rn pd.setBookAuthor("Godfather");rn pd.setBookPublish("1"); rn pd.setBookIsbn("DVD");rn session.save(pd);rn tx.commit();rn session.close();rn System.out.println("dfsfsdfsdf");rn catch (HibernateException e) rn e.printStackTrace();rn rn rnrnrn报错信息:rnHibernate: insert into books (book_name, bookAuthor, book_publish, book_date, book_isbn, book_page, book_price, book_content, bookId) values (?, ?, ?, ?, ?, ?, ?, ?, ?)rnorg.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)rn at root.Test.main(Test.java:25)rnCaused by: java.sql.BatchUpdateException: Unknown column 'bookAuthor' in 'field list'rn at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1257)rn at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:943)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174)rn ... 8 morernrn搞了 2天了,还是不知道什么原因,请 大侠 支援下!
org.hibernate.exception.DataException: Could not execute JDBC batch update
今天向mysql中插入数据出现很奇怪问题rnUser p1=new User();rn p1.setName("测试数据");rn p1.setPassword("12345");rn System.out.println("insert suceess");rn当p1.setName("")中不为中文,运行正常,当为中文就出错org.hibernate.exception.DataException: Could not execute JDBC batch updatern说明p1.setName("")为mysql中user表对应字段的值rn
Hibernate operation: Could not execute JDBC batch update;
1:STRUTS+HIBERNATE+SPRING框架 原来项目的数据库是SQL2000,原来所有表是HIBERNATE生成的主键是用UUIX,现在改成ORACLE后随便运行一个保存测试用例的时候,会出现主键为空的异常.rn也就是UUIX在ORACLE不生成,也就不能插入.如果重新在ORACLE的一张表上生成一个表 做保存的话 是没问题的.不可能在把原来的整个项目的表都去生成一遍,请问怎么改?rnrn谢谢..异常如下:rnorg.springframework.jdbc.BadSqlGrammarException: Hibernate operation: Could not execute JDBC batch update; bad SQL grammar [insert into cms_cnparts.dbo.T_LINK (linkName, typeID, linkUrl, picture, linkIntro, createTime, email, tel, isPass, orderID, memberID, linkID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is java.sql.BatchUpdateException: ORA-00926: missing VALUES keywordrnrnCaused by: java.sql.BatchUpdateException: ORA-00926: missing VALUES keywordrnrn at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)rnrnHIBERNATE配置如下:rn rn rn org.hibernate.dialect.OracleDialectrn rn rn jdbc:oracle:thin:@10.241.96.123:1521:ORA9Irn rn elplatrn elplat_168rn rn oracle.jdbc.driver.OracleDriverrn rn rn cms_cnpartsrn rn rn threadrn truernrn/************************************rn随便一张表的映射如下rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn
急!!!Could not execute JDBC batch update
我用的的Hibernate3.1,tomcat6.0,用myeclipse7.0生成持久化类,数据库为oraclern一个表,两个字段,一个imageid,一个保存图片,BLOB类型,在保存时报这个错误,如果主键生成方式为native时没事,配置文件如下:rnrn rn rn rn rn rn rn rn rn rnrn如果不自动生成主键,去掉那个设置就会报这个错误。希望高手帮忙。
Hibernate+Spring+Struts "Could not execute JDBC batch update"
org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch updaternCaused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch updaternrn望高手指点
如何解决could not execute jdbc batch update?
如何解决could not execute jdbc batch update.本人是菜鸟不知道此问题那里出错,请教.谢谢!
Could not execute JDBC batch update 有中文
hibernate struts2 spring 保存和修改时报出rnrn org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)rn at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)rn at com.zzl.student.dao.impl.DepartmentDAOImpl.save(DepartmentDAOImpl.java:52)rn at com.zzl.student.service.impl.DepartmentServiceImpl.save(DepartmentServiceImpl.java:20)rn at com.zzl.student.db.main.Dbru.findBySql_Access(Dbru.java:77)rn at com.zzl.student.db.main.Dbru.main(Dbru.java:31)rnCaused by: java.sql.BatchUpdateException: ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值rnrn at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8738)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)rn ... 11 morernrn
Could not execute JDBC batch update异常,求大神科普一下
初学Hibernate,想用Hibernate连Oracle然后实现插入功能,最后出现这个异常rnException in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)rn at cn.pb.hibernate.dao.LoginDao.sava(LoginDao.java:22)rn at cn.pb.hibernate.test.TestHi.main(TestHi.java:19)rnCaused by: java.sql.BatchUpdateException: ORA-00942: 表或视图不存在rnrn at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10656)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)rn ... 9 morernrn用plsql可以连到数据库进行插入rn求大神帮帮忙看下
求教:Hibernate异常Could not execute JDBC batch update
配置文件为:rn[code=Java]rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rn我想单独添加一条数据我就直接用session.save(Person);rn然后系统给我报个错org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update。rn发出的sql语句是:rnHibernate: insert into PERSONINFO (PID, NAME, TYPE, ISLEAF, pid, CID) values (?, ?, ?, ?, ?, ?)rn就是pid出现重复列了,这是什么原因还是配置文件哪里有问题,好像它把parent对象也级联保存了,rn但是我删除cascade配置也没用, 求教了。rn(不知道大家看的懂这配置文件意思不,就是这样配置可以生成树的结构如:cid,pid)rn
Could not execute JDBC batch update 异常了 怎么调试?
SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8]rnSLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.rnSLF4J: Class path contains multiple SLF4J bindings.rnSLF4J: Found binding in [jar:file:/F:/data/myjava/%e5%ae%89%e8%a3%85%e5%8c%85%e6%96%87%e4%bb%b6/Hibernate/hibernate%e5%bf%85%e9%a1%bb/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]rnSLF4J: Found binding in [jar:file:/D:/Mysoftware/AppData/Local/Genuitec/Common/plugins/com.genuitec.org.hibernate.eclipse_3.2.4.CR1-me201003101716/myeclipse-data/3.3/lib/required/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]rnSLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.rnlog4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).rnlog4j:WARN Please initialize the log4j system properly.rnlog4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.rnHibernate: insert into hibernate.LOGIN (password, USERNAME) values (?, ?)rnException in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)rn at com.pb.hibernate.po.LoginDao.save(LoginDao.java:29)rn at com.pb.hibernate.test.Test.main(Test.java:18)rnCaused by: java.sql.BatchUpdateException: ORA-00942: 表或视图不存在rnrn at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10656)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)rn ... 9 morern
org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch
rn代码如下rn public void mergeAll(final String entityName,rn final List list) rn this.getHibernateTemplate().execute(new HibernateCallback() rn @Overridern public Object doInHibernate(Session session)rn throws HibernateException, SQLException rn try rn rn for (int i = 0;i < list.size(); i++) rn session.merge(entityName, list.get(i));rn if ((i + 1) % 50 == 0) rn session.flush();rn session.clear();rn rn rn if (list.size()%50!= 0) rn session.flush();rn session.clear();rn rn catch (Exception ex) rn logger.error(ex.toString(), ex);rn rn return null;rn rn );rn rnrnrnrnrn错误如下rnrnrnrnrnrn[2017-09-19 13:33:10,475]ERROR923576[epserverQuartzScheduler_Worker-3] - com.hundsun.epserver.persistence.dao.impl.DataPersistenceDaoImpl$5.doInHibernate(DataPersistenceDaoImpl.java:177) - org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch updaternorg.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:105)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)rn at sun.reflect.GeneratedMethodAccessor167.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1282)rn at $Proxy93.flush(Unknown Source)rn at com.hundsun.epserver.persistence.dao.impl.DataPersistenceDaoImpl$5.doInHibernate(DataPersistenceDaoImpl.java:173)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)rn at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339)rn at com.hundsun.epserver.persistence.dao.impl.DataPersistenceDaoImpl.mergeAll(DataPersistenceDaoImpl.java:159)rn at com.hundsun.epserver.persistence.service.DataPersistenceService.mergeAll(DataPersistenceService.java:62)rn at com.hundsun.epserver.persistence.service.DataPersistenceService$$FastClassByCGLIB$$acaf56d6.invoke()rn at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)rn at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)rn at com.hundsun.epserver.persistence.service.DataPersistenceService$$EnhancerByCGLIB$$e862cf8d.mergeAll()rn at com.hundsun.epserver.cache.manage.CallCache.doPersistence(CallCache.java:261)rn at com.hundsun.epserver.cache.manage.AbstractPersistence.persistence(AbstractPersistence.java:46)rn at com.hundsun.epserver.quartz.job.PersistenceCallCache.execute(PersistenceCallCache.java:36)rn at org.quartz.core.JobRunShell.run(JobRunShell.java:202)rn at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)rnCaused by: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transactionrn at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2043)rn at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1467)rn at sun.reflect.GeneratedMethodAccessor186.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)rn at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)rn at $java.sql.Statement$$EnhancerByProxool$$a48276c5.executeBatch()rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)rn ... 30 morernCaused by: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transactionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)rn at com.mysql.jdbc.Util.getInstance(Util.java:386)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1066)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)rn at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2815)rn at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)rn at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2458)rn at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)rn ... 39 more
Could not execute JDBC batch update; SQL [update exchange.student set
页面可以获取到传来的值,这是运行结果 查看并修改信息的jsp部分rn[img=https://img-bbs.csdn.net/upload/201504/15/1429090642_285222.jpg][/img]rn点击确定 出现rn[img=https://img-bbs.csdn.net/upload/201504/15/1429090776_37313.png][/img]rn怎么解决??? 下面是我的java部分代码rn这是我的修改的jsp的部分rn[img=https://img-bbs.csdn.net/upload/201504/15/1429090456_307555.png][/img]rn这是我的dao层实现类部分rn[img=https://img-bbs.csdn.net/upload/201504/15/1429090895_640180.png][/img]rn这是我的action部分rn[img=https://img-bbs.csdn.net/upload/201504/15/1429091153_38229.png][/img]rn我只想改部分 并不想都改 怎么解决???rn
小白求助Could not execute JDBC batch update解决方法
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)rn at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)rn at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)rn at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)rn at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2667)rn at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2912)rn at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:97)rn at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:189)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)rn at cn.itcast.chapter28.manytomany.ManyToManyTest.test3(ManyToManyTest.java:67)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)rn at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:363)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)rnCaused by: java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`chapter13`.`s_c`, CONSTRAINT `FK1BB977438DF92` FOREIGN KEY (`cid`) REFERENCES `course` (`id`))rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)rn at java.lang.reflect.Constructor.newInstance(Unknown Source)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)rn at com.mysql.jdbc.Util.getInstance(Util.java:408)rn at com.mysql.jdbc.SQLError.createBatchUpdateException(SQLError.java:1162)rn at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1778)rn at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1262)rn at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:958)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)rn ... 38 morernCaused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`chapter13`.`s_c`, CONSTRAINT `FK1BB977438DF92` FOREIGN KEY (`cid`) REFERENCES `course` (`id`))rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)rn at java.lang.reflect.Constructor.newInstance(Unknown Source)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)rn at com.mysql.jdbc.Util.getInstance(Util.java:408)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)rn at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2501)rn at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)rn at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079)rn at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1756)rn ... 42 morernrn刚在练习 多对多关系级联删除~~rnrnhibernate.cfg.xmlrnrnrnrnrn rn rn org.hibernate.dialect.MySQLDialect rn rn rn rn com.mysql.jdbc.Driverrn rn rn rn jdbc:mysql:///chapter13rn rn rn rn rootrn rn rn rn rootrn rn rn truern rn truern rn updatern rn rn rn rn rn rn rnrnrnStudent.hbm.xmlrnrnrnrnrn rn rn rn rn rn rn rn rn rn rnrnrnCourse.hbm.xmlrnrnrnrnrn rn rn rn rn rn rn rn rn rn rnrnrn求大神看看哪里出了问题,谢谢
Could not execute JDBC batch update;nested exception is org.hibernate.exception
请教一下 tomcat虽然报的是空值的错误,但是我的数据库有数据。。rnHibernate: insert into BIZ_CLAIM_VOUCHER (NEXT_DEAL_SN, CREATE_SN, create_time, EVENT, TOTAL_ACCOUNT, STATUS, ID) values (?, ?, ?, ?, ?, ?, ?)rnCould not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch updaternjava.lang.NullPointerExceptionrn at org.hibernate.collection.PersistentSet.addAll(PersistentSet.java:243)rn at cn.hzh.myoa.biz.impl.ClaimVoucherServiceImpl.addDetail(ClaimVoucherServiceImpl.java:42)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at $Proxy1.addDetail(Unknown Source)rn at cn.hzh.myoa.action.ClaimVoucherAction.addDetail(ClaimVoucherAction.java:55)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rnrnrn在这个方法里报的错:rnpublic List getDetails(Serializable id) rn // TODO Auto-generated method stubrn System.out.println("id"+" "+id);rn rn String hql="from ClaimVoucherDetail cvd where cvd.master.id=?";rn List list=null;rn try rn list = this.getHibernateTemplate().find("from ClaimVoucherDetail cvd where cvd.master.id=?",new Object[]id);rn System.out.println(list.size());rn catch (DataAccessException e) rn // TODO Auto-generated catch blockrn System.out.println(e.getMessage());rn rn rn return list; rn
奇怪的数据插入错误Could not execute JDBC batch update?
最近学习struts+spring+hibernate开发模式,出现了这样的问题:rn框架配置好后,向数据库表插入一条记录成功,再次插入记录时报错,rn并且只能在启动web服务器后进行一次插入操作,再插入就报错,错误信息如下:rnrnexceptionrnrnjavax.servlet.ServletException: Hibernate operation: Could not execute JDBC batch update; SQL [insert into T_FILE (FILE_NAME, FILE_CONTENT, REMARK, FILE_ID) values (?, ?, ?, ?)]; Duplicate entry '402866810e3d3185010e' for key 1; nested exception is java.sql.BatchUpdateException: Duplicate entry '402866810e3d3185010e' for key 1rn org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:75)rn org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rnrnroot causernrnorg.springframework.dao.DataIntegrityViolationException: Hibernate operation: Could not execute JDBC batch update; SQL [insert into T_FILE (FILE_NAME, FILE_CONTENT, REMARK, FILE_ID) values (?, ?, ?, ?)]; Duplicate entry '402866810e3d3185010e' for key 1; nested exception is java.sql.BatchUpdateException: Duplicate entry '402866810e3d3185010e' for key 1rn.......rnrn其中T_FILE表的主键为FILE_ID,在hibernate配置文件中的生成方式为uuid.hex,rn为什么第二次插入数据时key的值没有变呢,还是上次插入的??
Hibernate 3.2 Hello world的问题(Could not execute JDBC batch update)
[color=#0000FF]rn很初级的问题 rnrn数据库创建table :Students 后用hibernate插入一行数据rnrnrn导入的hibernate包有8个 required文件夹的6个 核心包1个 slf4j包1个rnrnhibernate.cfg.xml文件是:rnrn[color=#993300]rnrnrn rn truern oracle.jdbc.driver.OracleDriverrn jdbc:oracle:thin:@127.0.0.1:1521:orclrn scottrn 1rn rn 2rn org.hibernate.dialect.OracleDialectrn rnrn rn[/color]rnrnhibernate.hbm.xml文件是:rnrn[color=#993300]rnrnrnrn rn rn rnrn[/color]rnrn测试的时候的代码:rnpublic static void main(String[] args) rn [color=#FFCC00]Student s = new Student();rn s.setAge(10);rn s.setSid(1);rn s.setName("老胡");rn rn Configuration cfg = new Configuration();rn SessionFactory sf = cfg.configure().buildSessionFactory();rn Session session = sf.openSession();rn session.beginTransaction();rn session.save(s);rn session.getTransaction().commit();rn session.close();rn sf.close();[/color]rn rnrn运行的时候出现的异常:rnrn[color=#000000]Hibernate: insert into Student (name, age, sid) values (?, ?, ?)rnException in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)rn at com.hibernate.test.HelloWorld.main(HelloWorld.java:25)rnCaused by: java.sql.BatchUpdateException: ORA-00942: 表或视图不存在rnrn at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:342)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10656)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)rn ... 8 more[/color]rnrnrn[b]请大家帮看看这个简单的程序怎么回事啊?????????[/b][size=18px][/size]rnrnrn[/color]
一个比较严重的hibernate问题!!Could not execute JDBC batch update
先粗略看下.....rnpublic class Income implements Serializable rn private int machineid;rnrn @Idrn @Column(name = "machineID", nullable = false, length = 10)rn public int getMachineid() rn return machineid;rn rnrn public void setMachineid(int machineid) rn this.machineid = machineid;rn rnrn private String cardid;rnrn @Idrn @Column(name = "cardID", length = 20, insertable = false, updatable = false, nullable = false)rn public String getCardid() rn return cardid;rn rnrn public void setCardid(String cardid) rn this.cardid = cardid;rn rnrn private String starttime;rnrn @Idrn @Column(name = "startTime", length = 30)rn public String getStarttime() rn return starttime;rn rnrn public void setStarttime(String starttime) rn this.starttime = starttime;rn rnrn private String finishtime;rnrn @Basicrn @Column(name = "finishTime", length = 30)rn public String getFinishtime() rn return finishtime;rn rnrn public void setFinishtime(String finishtime) rn this.finishtime = finishtime;rn rnrn private double cost;rnrn @Basicrn @Column(name = "cost", length = 6, precision = 2)rn public double getCost() rn return cost;rn rnrn public void setCost(double cost) rn this.cost = cost;rn rnrn private Machine machineByMachineid;rnrn @ManyToOnern @JoinColumn(name = "machineID", referencedColumnName = "machineID")rn public Machine getMachineByMachineid() rn return machineByMachineid;rn rnrn public void setMachineByMachineid(Machine machineByMachineid) rn this.machineByMachineid = machineByMachineid;rn rnrn private User userByCardid;rnrn @ManyToOnern @JoinColumn(name = "cardID", referencedColumnName = "cardID", insertable = false, updatable = false)rn public User getUserByCardid() rn return userByCardid;rn rnrn public void setUserByCardid(User userByCardid) rn this.userByCardid = userByCardid;rn rnrnrn再实现中rn Income income = new Income(); //在收入表中增加新的信息rn income.setMachineid(machineID);rn income.setCardid(cardID);rn String date = timeFormat.format(new Date());rn income.setStarttime(date);rn session.save(income);rnrn不知道为什么总是说错误...rnorg.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update"rncause = java.sql.BatchUpdateException@3710"java.sql.BatchUpdateException: Field 'startTime' doesn't have a default value"rnsql = java.lang.String@3711"insert into wangbaalias.income (cost, finishTime, machineID, cardID) values (?, ?, ?, ?)"rnrn请指点一下!!!谢谢
hibennate的org.springframework.dao.DataIntegrityViolationException Could not execute JDBC batch update; 怎么改啊
web +service+dao +orcalernorg.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch updatern org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:628)rn org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:408)rn org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)rn org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:622)rn com.sy.question.dao.ZhjzQuestionsDAO.save(ZhjzQuestionsDAO.java:29)rn com.sy.question.service.SaveQuestionService.saveQuestion(SaveQuestionService.java:23)rn com.sy.question.web.SaveQuestionAction.execute(SaveQuestionAction.java:66)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:810)rn org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)rnrn
请教高手Hibernate问题(org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update)
提示的错误内容如下:rnHibernate: select max(ID) from TGS_ENTERPRISE_COUNTINFOrnHibernate: insert into TGS_ENTERPRISE_COUNTINFO (QYZCH, CORNAME, CORNAME_ENG, REG_CODE, REG_FUNDING, REG_DATE, E_AREAID, E_YWFWID, ADDRESS, POSTCODE, TEL, TEX, EMAIL, WEBSITE, E_FR, E_FR_CODE, XUELI, AGE, SOFT_QYRZ, SYS_JCZZRZ, CMMRZ, SOFT_RZJG, SOFT_RZH, SYS_RZJG, SYS_RZH, CMMRZ_LEVEL, ZGDW, ZGDW_FZR, AUTHOR, DATE, CMMRZ_RZH, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)rnorg.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)rn at tgcom.hibernate.yb.TgsEnterpriseCountinfoDAO.save(TgsEnterpriseCountinfoDAO.java:68)rn at tgcom.struts.yb.action.TgsEnterpriseCountinfoAction.execute(TgsEnterpriseCountinfoAction.java:42)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)rn at java.lang.Thread.run(Thread.java:595)rnCaused by: java.sql.BatchUpdateException: ORA-01747: 无效的用户.表.列,表.列,或列规格rnrn at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:4210)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)rn ... 29 morern以下TgsEnterpriseCountinfo.hbm.xmlrnrn rn rn rn rn rn rn rn rn rn
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updat
Hibernate: rn /* insert com.sino.module.dmc.drugpurchase.entity.OrderFormrn */ insert rn intorn TEST.ORDER_FORMrn (ORDER_NO, HOSPITAL_NO, HOSPITAL_NAME, DISTRIBUTOR_NO, DISTRIBUTOR_NAME, APPLY_NAME, APPLY_TIME, ORDER_TITLE, ORDER_TYPE, ORDER_LEVEL, TOTAL_AMOUNT, REMARKS, STATE, ORI_ORDER_NO) rn valuesrn (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)rn2010-01-07 10:13:28,296 WARN [org.hibernate.util.JDBCExceptionReporter] - rn2010-01-07 10:13:28,296 ERROR [org.hibernate.util.JDBCExceptionReporter] - rn2010-01-07 10:13:28,296 WARN [org.hibernate.util.JDBCExceptionReporter] - rn2010-01-07 10:13:28,296 ERROR [org.hibernate.util.JDBCExceptionReporter] - rn2010-01-07 10:13:28,312 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - rnorg.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)rn at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)rn at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:420)rn at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:694)rn at com.sino.dao.hibernate.CommonDaoImpl.save(CommonDaoImpl.java:75)rn at test.TestExtends.savePurchaseOrder(TestExtends.java:19)rn at test.TestSession.getSessionDao(TestSession.java:53)rn at test.Test.main(Test.java:14)rnCaused by: java.sql.BatchUpdateException: ORA-12704: ??????rnrn at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10768)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)rn ... 13 morern2010-01-07 10:13:28,328 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - rn2010-01-07 10:13:28,390 INFO [org.springframework.jdbc.support.SQLErrorCodesFactory] - rnException in thread "main" org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Could not execute JDBC batch update; uncategorized SQLException for SQL [/* insert com.sino.module.dmc.drugpurchase.entity.OrderForm */ insert into TEST.ORDER_FORM (ORDER_NO, HOSPITAL_NO, HOSPITAL_NAME, DISTRIBUTOR_NO, DISTRIBUTOR_NAME, APPLY_NAME, APPLY_TIME, ORDER_TITLE, ORDER_TYPE, ORDER_LEVEL, TOTAL_AMOUNT, REMARKS, STATE, ORI_ORDER_NO) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; SQL state [72000]; error code [12704]; ORA-12704: ??????rn; nested exception is java.sql.BatchUpdateException: ORA-12704: ??????rnrn at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)rn at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)rn at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)rn at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)rn at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:694)rn at com.sino.dao.hibernate.CommonDaoImpl.save(CommonDaoImpl.java:75)rn at test.TestExtends.savePurchaseOrder(TestExtends.java:19)rn at test.TestSession.getSessionDao(TestSession.java:53)rn at test.Test.main(Test.java:14)rnCaused by: java.sql.BatchUpdateException: ORA-12704: ??????rnrn at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10768)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)rn at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:420)rn ... 6 morern上面的是错误信息,不知道 为什么 我一保存 就报错 ,查询没有问题 就是添加一条数据时就报这个错误 用的是hibernatern
请教:org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch ...
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)rn at com.shop.dao.OrderDAO.saveOrder(OrderDAO.java:20)rn at com.shop.struts.action.OrderAction.submit(OrderAction.java:73)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rnCaused by: java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order=1 where lineid=1' at line 1rn at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:894)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)rn ... 33 morernrnrn在存储一对多时出的异常,如何解决。。Caused by: java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order=1 where lineid=1' at line 1,我用Hibernate,save()提交时就出现这样的错误了
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC
SSH删除操作的时候出现了这个错误,我也网上查了一下解决方法,但没能解决,希望得到大家的帮助,谢谢了rn[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/17.gif][/img]Hibernate: select students0_.stu_no as stu1_1_0_, students0_.col_no as col2_1_0_, students0_.class_no as class3_1_0_, students0_.dept_no as dept4_1_0_, students0_.stu_name as stu5_1_0_, students0_.stu_sex as stu6_1_0_, students0_.stu_birthday as stu7_1_0_, students0_.nativeplace as nativepl8_1_0_, students0_.telphone as telphone1_0_, students0_.mianmao as mianmao1_0_, students0_.cometime as cometime1_0_ from jrmtkq.students students0_ where students0_.stu_no=?rnHibernate: select stuusers0_.stu_no as stu1_1_, stuusers0_.stu_no as stu1_0_0_, stuusers0_.pwd as pwd0_0_ from jrmtkq.stuuser stuusers0_ where stuusers0_.stu_no=?rnHibernate: delete from jrmtkq.students where stu_no=?rn29854 [http-apr-8089-exec-4] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1451, SQLState: 23000rn29854 [http-apr-8089-exec-4] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot delete or update a parent row: a foreign key constraint fails (`jrmtkq`.`stuuser`, CONSTRAINT `user_fk2` FOREIGN KEY (`stu_no`) REFERENCES `students` (`stu_no`))rn29854 [http-apr-8089-exec-4] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with sessionrnorg.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)rnrn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)rnrn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)rn at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)rnrn at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at $Proxy4.delStudent(Unknown Source)rn at jrmt.service.StudentServiceImp.delStudent(StudentServiceImp.java:33)rnrn at jrmt.controller.StudentAction.delStudent(StudentAction.java:95)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rnrn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rnrn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rnrn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rnrn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rnrn rnCaused by: java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`jrmtkq`.`stuuser`, CONSTRAINT `user_fk2` FOREIGN KEY (`stu_no`) REFERENCES `students` (`stu_no`))rnrn at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1693)rn at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1108)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)rn ... 90 morern数据库设计部分rncreate database jrmtkq;rnuse jrmtkq;rn--学院表rncreate table colleges(rn col_no char(10) primary key,rn col_name varchar(40) not null rn)rn--专业信息表rncreate table depts(rn dept_no char(10) primary key,rn col_no char(10) not null,rn dept_name varchar(40),rn constraint dept_fk foreign key(col_no)rn references colleges(col_no)rn)rn--班级信息表rncreate table classes(rn class_no char(10) primary key,rn dept_no char(10) not null,rn col_no char(10) not null,rn class_name varchar(20) not null,rn constraint classes_fk1 foreign key(dept_no)rn references depts(dept_no),rn constraint classes_fk2 foreign key(col_no)rn references colleges(col_no)rn)rn--课程信息表rncreate table course(rn cou_no char(16) primary key,rn cou_name varchar(40) not null,rn xuefen numeric(4,1) not null,rn col_no char(10) not null,rn dept_no char(10) not null,rn constraint cou_fk1 foreign key(dept_no) rn references depts(dept_no),rn constraint cou_fk2 foreign key(col_no)rn references colleges(col_no)rn)rn--学生表rncreate table students(rn stu_no char(20) primary key,rn stu_name varchar(30) not null,rn stu_sex char(6)rn check(stu_sex='male' or stu_sex='female'),rn stu_birthday date,rn nativeplace varchar(80),rn col_no char(10) not null,rn dept_no char(10) not null,rn class_no char(10) not null,rn telphone char(16) not null,rn mianmao varchar(10) not null,rn cometime date not null,rn constraint stu_fk1 foreign key(class_no)rn references classes(class_no),rn constraint stu_fk2 foreign key(dept_no)rn references depts(dept_no),rn constraint stu_fk3 foreign key(col_no)rn references colleges(col_no)rn)rn部分省略.....
刚学Hibernate时有ConstraintViolationException: Could not execute JDBC batch update异常
我刚学习使用Hibernate,在执行向数据库中添加一条数据的时候出现了异常:rn控制台报错:rnConstraintViolationException: Could not execute JDBC batch update rnat org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecuti。。。。。rn 这个异常.。。。估计一下应该是实体类映射的问题:但是又发现不了什么错误。还请各位指教一下。。。rnrn以下是我的编码:rnrn实体对象类:rnprivate int usId; //用户IDrn private String userName; //用户名rn private String userPwd; //用户密码 rn rn public int getUsId() rn return usId;rn rn public void setUsId(int usId) rn this.usId = usId;rn rnrn rn public String getUserName() rn return userName;rn rn public void setUserName(String userName) rn this.userName = userName;rn rn public String getUserPwd() rn return userPwd;rn rn public void setUserPwd(String userPwd) rn this.userPwd = userPwd;rn rnrnrn实体类映射文件:rnrnrnrnrnrnrnrn seq_uIdrnrnrnrnrnrnrnrnrn数据库:rnrncreate table tbUsers(rnuserId number primary key,rnuserName varchar2(30) not null,rnuserPwd varchar2(30) not nullrn)rnrnrnrn写得很简单。。却报了错。。。还请大家帮帮忙。。先谢谢了。。。
各位大哥 帮我看下这个异常:Could not execute JDBC batch update
rn 请前辈耐心指教 这个异常出现在用EJB更新数据的时候 代码和异常都非常简单 rn 异常信息:rn[code=Java]rnorg.hibernate.exception.DataException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:100)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)rn at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:504)rn at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)rn at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269)rn at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89)rn at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)rn at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1423)rn at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137)rn at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)rn at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170)rn at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)rn at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)rn at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)rn at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)rn at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)rn at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)rn at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)rn at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)rn at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)rn at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)rn at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)rn at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)rn at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)rn at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)rn at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)rn at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:176)rn at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:216)rn at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)rn at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)rn at $Proxy255.Update(Unknown Source)rn at com.ary.ServicesImp.GrkhRcsrServicesImp.modifyGrkhRcsr(GrkhRcsrServicesImp.java:351)rn[/code]rnrnrn代码:rn[code=Java]rn /**rn * 更新记录rn * @param entityrn */rn //这个方法在 DBExecute 类里 是个EJBrn @SuppressWarnings("unchecked")//屏蔽警告rn //这里的 和 T 是什么意思啊 rn public T Update(Class entityClass, Object entity) rn try rn T result = (T) entityManager.merge(entity);rn log.info("update successful");rn return result;//这里运行完了以后才抛的异常 这里没抛 不知道怎么回事rn catch (RuntimeException re) rn throw re;rn rn rnrnrnrn //也是在EJB里 新建另一个类调用更新方法rn @EJB(beanName = "DBExecute") DBExcuteLo dBExcute;rn //Percusinfoc 是一个实体类rn //psfc 是这个实体的实力rn Percusinfoc psfc = new Percusinfoc();rn // pcfid 一个自动增长列 但也被表单接收 由表单传过来rn psfc.setPcfid(Integer.parseInt(request.getParameter("pcfid")));rn psfc.setCusId(request.getParameter("cusId"));//cusId 是从表单里传来的数据 rn ....rnrn dBExcute.Update(Percusinfoc.class, psfc);// 调用那个更新方法 rnrnrnrnrn //实体类是用MyEclipse 自动创建的 rn @Entityrn @Table(name = "percusinfoc", catalog = "paccds")rn public class Percusinfoc implements java.io.Serializable rn private Integer pcfid;rn private String cusId;rnrn @Idrn @GeneratedValue(strategy = IDENTITY)rn @Column(name = "pcfid", unique = true, nullable = false, length = 11)rn public Integer getPcfid() rn return this.pcfid;rn rnrn public void setPcfid(Integer pcfid) rn this.pcfid = pcfid;rn rnrn @Column(name = "cusID", length = 20)rn public String getCusId() rn return this.cusId;rn rnrn public void setCusId(String cusId) rn this.cusId = cusId;rn rnrn ...rn rn rn[/code]
求救:Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch u
我在做Spring+Hibernate 时遇见了下面的问题,已经错了好几天了,数据库也从新建了,表关系也重新映射了。。。。。求救SOSrnrnlog4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).rnlog4j:WARN Please initialize the log4j system properly.rnException in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updaternCaused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)rn at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)rn at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:373)rn at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:632)rn at com.usernews.dao.impl.UserNewsDaoImpl.addNews(UserNewsDaoImpl.java:27)rn at com.usernews.operation.impl.UserNewsServiceImpl.CommitNews(UserNewsServiceImpl.java:71)rn at com.usernews.text.Text.textAdd(Text.java:121)rn at com.usernews.text.Text.main(Text.java:167)rnCaused by: java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, author, startdate, enddate, iconpath, note, checkflag, newsid) values ('ti' at line 1rn at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1103)rn at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:853)rn at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)rn ... 12 morern
org.hibernate.exception.SQLGrammarException: could not execute update query
IcWarehouseCheckBillDetail的实体类rn[code=java]rnpublic class IcWarehouseCheckBillDetail implements java.io.Serializable rnrn // Fieldsrnrn private IcWarehouseCheckBillDetailId id;rn private String productId;rn private String productName;rnrn // Constructorsrnrn /** default constructor */rn public IcWarehouseCheckBillDetail() rn rnrn /** minimal constructor */rn public IcWarehouseCheckBillDetail(IcWarehouseCheckBillDetailId id) rn this.id = id;rn rn rn public IcWarehouseCheckBillDetail(IcWarehouseCheckBillDetailId id,String productId,String productName) rn this.id = id;rn this.productId = productId;rn this.productName = productName;rn rn // Property accessorsrnrn public IcWarehouseCheckBillDetailId getId() rn return this.id;rn rnrn public void setId(IcWarehouseCheckBillDetailId id) rn this.id = id;rn rnrn public String getProductId() rn return productId;rn rnrn public void setProductId(String productId) rn this.productId = productId;rn rnrn public String getProductName() rn return productName;rn rnrn public void setProductName(String productName) rn this.productName = productName;rn rnrnrn[/code]rnrnIcWarehouseCheckBillDetailId的实体类rn[code=java]rnpublic class IcWarehouseCheckBillDetailId implements java.io.Serializable rnrn // Fieldsrnrn private String companyId;rnrn private String stockCheckId;rnrn private String guid;rnrn // Constructorsrnrn /** default constructor */rn public IcWarehouseCheckBillDetailId() rn rnrn /** full constructor */rn public IcWarehouseCheckBillDetailId(String companyId, String stockCheckId,rn String guid) rn this.companyId = companyId;rn this.stockCheckId = stockCheckId;rn this.guid = guid;rn rnrn // Property accessorsrnrn public String getCompanyId() rn return this.companyId;rn rnrn public void setCompanyId(String companyId) rn this.companyId = companyId;rn rnrn public String getStockCheckId() rn return this.stockCheckId;rn rnrn public void setStockCheckId(String stockCheckId) rn this.stockCheckId = stockCheckId;rn rnrn public String getGuid() rn return this.guid;rn rnrn public void setGuid(String guid) rn this.guid = guid;rn rnrn public boolean equals(Object other) rn if ((this == other))rn return true;rn if ((other == null))rn return false;rn if (!(other instanceof IcWarehouseCheckBillDetailId))rn return false;rn IcWarehouseCheckBillDetailId castOther = (IcWarehouseCheckBillDetailId) other;rnrn return ((this.getCompanyId() == castOther.getCompanyId()) || (thisrn .getCompanyId() != nullrn && castOther.getCompanyId() != null && this.getCompanyId()rn .equals(castOther.getCompanyId())))rn && ((this.getStockCheckId() == castOther.getStockCheckId()) || (thisrn .getStockCheckId() != nullrn && castOther.getStockCheckId() != null && thisrn .getStockCheckId().equals(castOther.getStockCheckId())))rn && ((this.getGuid() == castOther.getGuid()) || (this.getGuid() != nullrn && castOther.getGuid() != null && this.getGuid()rn .equals(castOther.getGuid())));rn rnrn public int hashCode() rn int result = 17;rnrn result = 37 * resultrn + (getCompanyId() == null ? 0 : this.getCompanyId().hashCode());rn result = 37rn * resultrn + (getStockCheckId() == null ? 0 : this.getStockCheckId()rn .hashCode());rn result = 37 * resultrn + (getGuid() == null ? 0 : this.getGuid().hashCode());rn return result;rn rnrnrn[/code]rn执行的Java代码是rn[code=java]rnSession session = this.getSessionFactory().openSession();rnString delSql = "delete IcWarehouseCheckBillDetail where id.stockCheckId = '"+stockCheckId+"'";rnQuery delQuery = session.createQuery(delSql);rndelQuery.executeUpdate();rn[/code]rnrn产生的异常:rn[code=java]rnorg.hibernate.exception.SQLGrammarException: could not execute update queryrn at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:99)rn at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:297)rn at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:871)rn at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)rn at com.testwebsvc.service.TaskService.commitFirmCheck(TaskService.java:2501)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)rn at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)rn at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)rn at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)rn at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)rn at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)rn at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)rn at java.lang.Thread.run(Unknown Source)rnCaused by: java.sql.SQLException: ORA-00904: "ICWAREHOUS0_"."STOCK_CHECK_ID": 标识符无效rnrn at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)rn at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)rn at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)rn at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)rn at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)rn at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)rn at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)rn at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)rn at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)rn at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:76)rn ... 29 morernrn[/code]rnrn请教大神,为什么说是“ "ICWAREHOUS0_"."STOCK_CHECK_ID": 标识符无效”引起的呢,明明我的代码里面没有ICWAREHOUSE0_
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC bat
我不知道这个操作为什么会报错,我操作的时候不会报错,但是其他人在测试的时候,发现了错误问题rnpublic String doAddUsergrant(String loginName, String[] grantlist) rn String msg = "";rn rn try rn String sql = "delete from usergrant where loginname='" + loginNamern + "'";rn this.Execdel(sql);rn this.em.flush();rn this.em.clear();rn if (grantlist != null && grantlist.length > 0) rn for (int i = 0; i < grantlist.length; i++) rn if (grantlist[i] != null && !grantlist[i].equals("")) rn Usergrant ugrant = new Usergrant();rn ugrant.setLoginname(loginName);rn ugrant.setMenuid(grantlist[i]);rn this.save(ugrant);rn this.em.flush();rn rn rn rn msg = "1";rn catch (Exception ex) rn msg = "-1";rn ex.printStackTrace();rn logger.error(ex);rn rn return msg;rn rn
求助 could not execute query 异常
系统框架用的是spring.net + nhibernate + iis host wcfrn会偶发的出现 could not execute query 异常导致系统崩溃,跟map肯定没关系,因为我执行select getdate()一样挂。rnwcf没问题,调用不操作数据库的方法都没事。rn而且数据库本身应该也没问题,没有锁出现,也没有很多用户连接。rn有时候过几分钟就自己恢复正常,不过多数时候都是杀掉wcf所在的w3wp.exe进程就好。rnrn操作系统是win2008,数据库是sql2008.rnrn实在是不知道从哪里下手,有人能给点建议不?rn
异常org.hibernate.exception.SQLGrammarException: could not execute query
本来是可以正确运行的,这没问题。就是新增了一个表,加入了外键约束后,自动生成了*.hbm.xml文件,而且还修改了已有的参考表的信息,就产生异常。rn 估计是对表的外键约束操作有点错误,请大家对加入外键后,*.hbm.xml文件应该如何配置及映射类应如何写给点建议,最好是贴出代码来,供大家学习参考,谢谢...rnrn异常信息:rn[code=Java]rnorg.hibernate.exception.SQLGrammarException: could not execute queryrn org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)rn org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn org.hibernate.loader.Loader.doList(Loader.java:2223)rn org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)rn org.hibernate.loader.Loader.list(Loader.java:2099)rn org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)rn org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)rn org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)rn org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)rn org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)rnrnroot cause rnrncom.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '071.user user0_' at line 1rn com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)rn com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)rn com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)rn com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)rn com.mysql.jdbc.Connection.execSQL(Connection.java:3283)rnrnrn[/code]rnMessage.hbm.xml代码:rn[code=XML]rnrn rn rn rn rn rn [color=#FF0000][/color]rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnUser.hbm.xml代码:rn[code=XML]rnrn rn rn rn rn rn rn rn rn rn rn rn //加入外键后,自动产生的代码 rn [color=#FF0000][/color] rnrn[/code]rn调试出的问题代码:rn[code=Java]rnpublic List queryAll() rn Session session = HibernateUtil.getSession();rn String hql = "FROM User ";rn Query q = session.createQuery(hql);rn List list = q.list(); //就这句q.list()异常报错rn HibernateUtil.closeSession(session);rn return list;rn rn[/code]
hibernate异常: Could not execute query ???
Hibernate + mssql 查询数据,出现异常:Could not execute queryrn如何解决 ?rnrn代码:rnrn truern jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=qsCenter rn rn sa rn rn rn org.hibernate.dialect.SQLServerDialectrn rn rn com.microsoft.jdbc.sqlserver.SQLServerDriverrn rn rn rnrnrnpublic List getUserInfo()rn List lt=null;rn tryrn cfg=new Configuration().configure();rn sf=cfg.buildSessionFactory();rn session=sf.openSession(); rn Transaction tx=session.beginTransaction();rn Query query=session.createQuery("from UserInfoVO");rn lt=query.list();rn tx.commit();rn session.close();rn rn catch(Exception e)rn System.out.println("小异: "+e.getMessage());rn rn return lt; rn
hibernate3 有关SQL语句中的默认关键字和Could not execute JDBC batch update异常问题`
刚开始学Hibernate`rnrn在做一个表的插入时``出现了个异常`rnrnorg.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updatern org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)rn org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)rn org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)rn org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)rn org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)rn org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)rn org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)rn org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)rn org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)rn org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)rn cn.pior.struts.action.AddEnforceLawerInfoAction.execute(AddEnforceLawerInfoAction.java:92)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrn我到网上查了查``说是有可能是因为SQL中使用了默认关键字的问题``rnrn这是H的输出`rnrnHibernate: insert into zfryinfo (dwId, bh, zfzh, name, IDCard, sex, brithday, education, bz, station, duty, nation, zzmm, remark, del, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)rnrn这里面有默认关键字吗?rnrn这默认关键字都有什么?rnrn以后在设计表时就应该回避这些默认关键字吗??
hibernate 插入多条记录问题 报错Could not execute JDBC batch update 困惑我2天了!
我做一个简单的例子 就是 客户与订单的关系rnJAVA 代码:rnpackage com.young.customer.pojo;rnrnimport java.io.Serializable;rn/**rn * Customers generated by MyEclipse - Hibernate Toolsrn */rnrnpublic class Customers implements java.io.Serializablernrnrn // Fieldsrn private long customerId;rn private String name;rn // Constructorsrnrn /** minimal constructor */rn public Customers(String name)rn rn this.name = name;rn rn public long getCustomerId()rn rn return this.customerId;rn rnrn public void setCustomerId(long customerId)rn rn this.customerId = customerId;rn rnrn public String getName()rn rn return this.name;rn rnrn public void setName(String name)rn rn this.name = name;rn rnrnrnpackage com.young.orders.domain;rnrnimport com.young.customer.domain.Customers;rnrn/**rn * AbstractOrders generated by MyEclipse - Hibernate Toolsrn */rnrnpublic class Orders implements java.io.Serializablernrnrn // Fieldsrnrn private long oid;rnrn private Customers customer;rnrn private String orderNumber;rnrn // Constructorsrn /** full constructor */rn public Orders(Customers customer, String orderNumber)rn rn this.customer = customer;rn this.orderNumber = orderNumber;rn rn public Customers getCustomer()rn rn return customer;rn rn public void setCustomer(Customers customer)rn rn this.customer = customer;rn rnrn public long getOid()rn rn return this.oid;rn rnrn public void setOid(long oid)rn rn this.oid = oid;rn rnrn public String getOrderNumber()rn rn return this.orderNumber;rn rnrn public void setOrderNumber(String orderNumber)rn rn this.orderNumber = orderNumber;rn rnrnrncustomers的配置文件rnrnrnrnrn rn rn rn rn SEQ_CUSTOMERIDrn rn rn rn rn rn rnrnrnorder的配置文件rnrnrnrnrn rn rn rn rn SEQ_ORDERSIDrn rn rn rn rn rn rn rnrnrn表脚本:rncreate table CUSTOMERSrn(rn CUSTOMOER_ID NUMBER(22) PRIMAY KEY,rn NAME VARCHAR2(20)rn)rncreate table ORDERSrn( rn OID NUMBER(12) PRIMAY KEY,rn ORDER_NUMBER VARCHAR2(12),rn CUSTOMOER_ID NUMBER(22) rn)rnalter table ORDERS rnadd constraint FK_ORDERS foreign key(CUSTOMOER_ID) references CUSTOMERS(CUSTOMOER_ID)rn序列都是建立好的 这个没有问题 我测试过rnrnpackage com.young.orders.dao;rnrnimport org.hibernate.Session;rnimport org.hibernate.Transaction;rnrnimport com.young.basefactory.SessionFactory;rnimport com.young.customer.pojo.Customers;rnimport com.young.orders.pojo.Orders;rnrnpublic class OrdersDaoImpl implements OrdersDaornrn private Session customer_session;rn private Transaction customer_tran;rnrn public static void main(String[] args)rn rn customer_session = SessionFactory.currentSession();rn //SessionFactory.currentSession(); 是已经写好了的静态方法没有问题rn //如果只插入customers 是没有问题的,如果同时插入customers 和orderrn //就报错 Could not execute JDBC batch update rn tryrn rn customer_tran = customer_session.beginTransaction();rn Customers customers = new Customers("jerry");rn customer_session.save(customers);rnrn Orders orders1 = new Orders(customers,"Jerry_Order01");rn Orders orders2 = new Orders(customers,"Jerry_Order02");rn rn customer_session.save(orders1);rn customer_session.save(orders2);rn rn customer_tran.commit();rn SessionFactory.closeSession();rn rn catch(Exception ex)rn rn System.out.println(ex);rn rn System.out.println("OK!!");rn rnrn //SessionFactory.currentSession(); 是已经写好了的静态方法没有问题rn //如果只插入customers 是没有问题的,如果同时插入customers 和orders1rn //orders2rn //就报错 Could not execute JDBC batch update rnrn请各位高手指点下啊!! rn
关于多对一关联的问题 Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
大家好,小弟最近正在学习hibernate中的多对一关联, 出现了一些问题.我现在很是着急.不知道是那个环节出现了问题. 可上火啦. 麻烦各位大哥帮助俺看看.小弟不胜感激!rn我是用的oracle数据库, 表id的生成方式是sequence rn 这个是customer.hbm.xmlrnrnrnrnrn rn rn rn rn CUSTOMER_SEQ_IDrn rn rn rn rn rn rn rn rn rnrnrnrn 这个是customer.hbm.xmlrnrnrnrnrnrn rn rn rn rn ORDER_SEQ_IDrn rn rn rn rn rnrn rn rn rnrnrn我所要建立的关联是 定单order与顾客customer建立的多与一关联. order表中的customerId参照customer表中的idrn 我又做了一个类,用来向这两个表中插入数据,rnrn public static void main(String[] args) throws Exception rn // TODO Auto-generated method stubrn SessionFactory sessionfactory = new Configuration().configure()rn .buildSessionFactory();rn Session session = sessionfactory.openSession();rn Transaction tran = session.beginTransaction();rn Customer customer = new Customer();rn customer.setAddress("山东");rn customer.setName("明明1");rn Order order = new Order();rn order.setOrdername("帐号名");rn order.setCustomer(customer);rn session.save(customer);rn session.save(order);rn tran.commit();rn rnrn 结果 是: 没有执行成功 ,出错啦, 我把出错的结果贴出来啦. 麻烦各位给俺看看rnrnrn log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).rnlog4j:WARN Please initialize the log4j system properly.rnException in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch updatern at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)rn at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)rn at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)rn at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)rn at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)rn at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)rn at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)rn at app.Application.main(Application.java:29)rnCaused by: java.sql.BatchUpdateException: ORA-00903: 表名无效rnrn at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:441)rn at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3377)rn at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174)rn ... 8 morern rn 拜托各位帮我看看,到底是那方面的错误,俺调二天啦!...........rn rnrn
求教Hibernate错误Could not execute JDBC batch update 请耐心看完
package com.xj.model;rnrnimport java.util.HashSet;rnimport java.util.Set;rnrnimport javax.persistence.*;rnrnimport org.hibernate.annotations.BatchSize;rnrn@Entityrn@BatchSize(size=5)rnpublic class Student rn private int id;rn private String name;rn private Set courses=new HashSet();rn @ManyToManyrn @JoinTable(rn name="score",rn joinColumns=@JoinColumn(name="student_id", referencedColumnName="id"),rn inverseJoinColumns=@JoinColumn(name="course_id", referencedColumnName="id")rn )rn public Set getCourses() rn return courses;rn rn public void setCourses(Set courses) rn this.courses = courses;rn rn @Idrn @GeneratedValuern public int getId() rn return id;rn rn public void setId(int id) rn this.id = id;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rnrnrnrnrnpackage com.xj.model;rnrnimport javax.persistence.Entity;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.Id;rnrnimport org.hibernate.annotations.BatchSize;rnrn@Entityrn@BatchSize(size=5)rnpublic class Course rn private int id;rn private String name;rn @Idrn @GeneratedValuern public int getId() rn return id;rn rn public void setId(int id) rn this.id = id;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rnrnrnrnrnpackage com.xj.model;rnrnimport javax.persistence.Entity;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.Id;rnimport javax.persistence.JoinColumn;rnimport javax.persistence.ManyToOne;rnimport javax.persistence.Table;rnrnimport org.hibernate.annotations.BatchSize;rnrn@Entityrn@BatchSize(size=5)rn@Table(name="score")rnpublic class Score rn private int id;rn private int s;rn private Course c;rn private Student t;rn @Idrn @GeneratedValuern public int getId() rn return id;rn rn public void setId(int id) rn this.id = id;rn rn @ManyToOnern @JoinColumn(name="course_id")rn public Course getC() rn return c;rn rn public void setC(Course c) rn this.c = c;rn rn @ManyToOnern @JoinColumn(name="student_id")rn public Student getT() rn return t;rn rn public void setT(Student t) rn this.t = t;rn rn public int getS() rn return s;rn rn public void setS(int s) rn this.s = s;rn rnrnrnrnrn@Testrn public void testSaveSCT() rn Student s1=new Student();rn s1.setName("xj");rn Student s2=new Student();rn s2.setName("hs");rn Course c1=new Course();rn c1.setName("java");rn Course c2=new Course();rn c2.setName("english");rn rn /*s1.getCourses().add(c1);rn s1.getCourses().add(c2);rn s2.getCourses().add(c1);rn s2.getCourses().add(c2);*/rn rn Score sc1=new Score();rn sc1.setT(s1);rn sc1.setC(c1);rn sc1.setS(90);rn rn Score sc2=new Score();rn sc2.setT(s1);rn sc2.setC(c2);rn sc2.setS(95);rn rn Score sc3=new Score();rn sc3.setT(s2);rn sc3.setC(c1);rn sc3.setS(70);rn rn Score sc4=new Score();rn sc4.setT(s2);rn sc4.setC(c2);rn sc4.setS(60);rn rn Session session = sf.getCurrentSession();rn session.beginTransaction();rn session.save(s1);rn session.save(s2);rn session.save(c1);rn session.save(c2);rn session.save(sc1);rn session.save(sc2);rn session.save(sc3);rn session.save(sc4);rn rn session.getTransaction().commit();rn rn rn rn简单点说就是student与course表之间以score表为中间表做映射 可是做save操作时报那样的错误 怎么调都调不好 求高手赐教赐教 非常感谢啊
一对多,插入的时候报错Could not execute JDBC batch update,请求帮忙!
rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rnrnrnpublic class Major implements java.io.Serializablern private static final long serialVersionUID=7049254736951558367L;rn private String id;rn private String name;rn private String shortname;rn private String department;rn private Set classeses=new HashSet(0);rn public String getId()rn return this.id;rn rn public void setId(String id)rn this.id=id;rn rn public String getName()rn return this.name;rn rn public void setName(String name)rn this.name=name;rn rn public String getShortname()rn return this.shortname;rn rn public void setShortname(String shortname)rn this.shortname=shortname;rn rn public String getDepartment()rn return this.department;rn rn public void setDepartment(String department)rn this.department=department;rn rn public Set getClasseses()rn return this.classeses;rn rn public void setClasseses(Set classeses)rn this.classeses=classeses;rn rnrnrnpublic class Classes implements java.io.Serializablern private static final long serialVersionUID=6183334115113485272L;rn private Integer id;rn private Major major;rn private String name;rn public Integer getId()rn return this.id;rn rn public void setId(Integer id)rn this.id=id;rn rn public Major getMajor()rn return this.major;rn rn public void setMajor(Major major)rn this.major=major;rn rn public String getName()rn return this.name;rn rn public void setName(String name)rn this.name=name;rn rnrnrn//测试语句rn Major m=new Major();rn Classes c=new Classes();rn m.setId("10");rn m.setName("hhhhhh");rn m.setShortname("dddddd");rn m.setDepartment("00001");rn c.setName("计科041");rn c.setMajor(m);rn m.getClasseses().add(c);rn Session session=HibernateSessionFactory.getSession(); rn Transaction tran=this.session.beginTransaction();rn session.save(m);rn tran.commit();rn session.close();rnrnrn数据库脚本rnCREATE TABLE `classes` (rn `id` int(11) NOT NULL auto_increment,rn `name` varchar(10) NOT NULL default '',rn `majorid` varchar(2) NOT NULL default '',rn PRIMARY KEY (`id`),rn KEY `pk_majorid` (`majorid`),rn CONSTRAINT `pk_majorid` FOREIGN KEY (`majorid`) REFERENCES `major` (`id`)rn) ENGINE=InnoDB DEFAULT CHARSET=gbk;rnrnCREATE TABLE `major` (rn `id` varchar(2) NOT NULL default '',rn `name` varchar(20) NOT NULL default '',rn `shortname` varchar(10) NOT NULL default '',rn `department` varchar(4) NOT NULL default '',rn PRIMARY KEY (`id`)rn) ENGINE=InnoDB DEFAULT CHARSET=gbk;
hibernate中这个问题Could not execute JDBC batch update怎么回事呀,快疯了
Hibernate: insert into student (name, age, id) values (?, ?, ?)rnException in thread "main" org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)rn at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
Strut+Spring+Hibernate应用,在一个Session中,先新增后删除,出现:Could not execute JDBC batch update错误。
程序是基于Strut+Spring+Hibernate。rnrn在一个Session中,先新增后删除,出现,Could not execute JDBC batch update错误。rnrn错误:rnorg.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updaternCaused by: org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updatern at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)rn at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)rn..............rnrnrn下面是程序:rn-----------------------------------------------------------------------------rnrnpublic class TestOrderServiceSpringImpl extends BaseTestCase rnrn public void testFindOrderById() rnrn IOrderService service = (IOrderService) super.getBean("orderService");rnrn try rn Order order = service.findOrderById(1);rn assertNotNull(order);rnrn catch (OrderException e) rn getLog().error(e);rn e.printStackTrace();rn rn rnrn public void testSaveNewOrder() throws Exception rnrn IOrderService service = (IOrderService) super.getBean("orderService");rnrn try rn Order order = new Order();rn order.setUserName("userName");rnrn [color=#33CCCC]service.saveNewOrder(order);[/color]rnrnrn int id = order.getId();rnrn[color=#FF0000] //super.tearDown();rn //super.setUp();[/color] 加入这两条,后面的Hibernate操作在另一个session中执先就可以rnrn [color=#33CCCC]service.deleteOrder(order);[/color] //执先这里出错。rnrn order = null;rnrn order = service.findOrderById(id);rnrn assertNull(order);rnrn catch (OrderException e) rn getLog().error(e);rn e.printStackTrace();rn rn rnrnrn--------------------------------------------------------------------------------rnrnpublic class BaseTestCase extends TestCase rnrn private static Log log = LogFactory.getLog(BaseTestCase.class);rnrn private ApplicationContext ac;rnrn SessionFactory sessionFactory;rnrn protected void setUp() throws Exception rn super.setUp();rnrn ac = new FileSystemXmlApplicationContext(rn "D:/workspace/code/order/WebRoot/WEB-INF/config/spring/applicationContext.xml");rnrn sessionFactory = (SessionFactory) getBean("mySessionFactory");rn Session s = sessionFactory.openSession();rn TransactionSynchronizationManager.bindResource(sessionFactory,rn new SessionHolder(s));rnrn rnrn protected void sessionFlush() throws Exception rnrn SessionHolder holder = (SessionHolder) TransactionSynchronizationManagerrn .getResource(sessionFactory);rn Session s = holder.getSession();rn s.flush();rn rnrn protected void tearDown() throws Exception rn super.tearDown();rnrn SessionHolder holder = (SessionHolder) TransactionSynchronizationManagerrn .getResource(sessionFactory);rn Session s = holder.getSession();rn s.flush();rn TransactionSynchronizationManager.unbindResource(sessionFactory);rn SessionFactoryUtils.closeSession(s);rn rnrn protected Object getBean(String name) rn return ac.getBean(name);rn rnrn public static Log getLog() rn return log;rn rnrnrnrnrnrnrn
求教 hibernate 超级高手 : (net.sf.hibernate.JDBCException) net.sf.hibernate.JDBCException: Could not execute JDBC batch update
我在 一个 hibernate 的 session 中 rnrnTransaction tx = session.beginTransaction();rn tx.delete(HQL);rn tx.save(Object);rnrntx.commit();rn// 在执行 commit() 的时候就会抛出异常...rnrnhibernate : (net.sf.hibernate.JDBCException) net.sf.hibernate.JDBCException: Could not execute JDBC batch updaternrn请问谁遇上过这个问题, 如何解决的, 谢谢高手 .
相关热词 c#部署端口监听项目、 c#接口中的属性使用方法 c# 昨天 c#func链接匿名方法 c#怎么创建文件夹 c#从键盘接收空格 c#da/ad c#部门请假管理系统 c#服务器socket c# 默认的访问修饰符