-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
 Post subject: Could not execute JDBC batch update
PostPosted: Wed Jul 02, 2008 9:07 pm 
Newbie

Joined: Wed Jul 02, 2008 9:01 pm
Posts: 1
08/06/30 12:13:14 org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
08/06/30 12:13:14 Caused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:575)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:117)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.BatchUpdateException: ORA-01031: insufficient privileges

This error is not that much informational. But the real problem is the HibernateTransactionManager is allowing one transaction per session/service as per our own application configuration. Hence it is not allowing to do select as well as update on the selected data inside the same class/transaction. To solve this problem do complete the select process in a transaction and do your update after comming out of that transaction that is do your update after the call returns the selected list from the select transaction.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 04, 2008 1:22 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
I most often see this probelm when a column or property isn't mapped property to the database. Is that possible? Check or post your Hibernate mapping files or JPA Java Persistence API annotations.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: Could not execute JDBC batch update
PostPosted: Fri Sep 11, 2009 4:43 am 
Newbie

Joined: Fri Sep 11, 2009 4:31 am
Posts: 1
Dear Friends,
I also have the same problem and part of exception is like below.Actually i am using mysql without problem and now trying to see if it works fine with postgresql too.Thus, experienced friends please tell me, what can be the reason that same code doesnt have problem with mysql but gives error with postgresql.
I am using hibernate-core-3.3.0.jar on windows.

Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into User (avatar, email, enabled, firstName, group_id, lastVisitDate, localization, msn, occupation, password, receiveNews, registerationDate, showMail, showSignature, signature, surname, username, website, id) values (NULL, forum4j@forum4j.com, 1, forum4j, 2, 2009-09-11 11:27:28.517000 +03:00:00, NULL, NULL, NULL, forum4j, 0, NULL, 0, 0, NULL, NULL, forum4j, NULL, 3) was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2537)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1328)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:351)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2674)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)


Top
 Profile  
 
 Post subject: Re: Could not execute JDBC batch update
PostPosted: Sat Sep 12, 2009 10:37 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Hmmmm...

I'm not sure if it's the same problem. The first problem is an SQL Grammar Exception, the second one has to do with batch updates. Those are two different turkeys to baste.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: Could not execute JDBC batch update
PostPosted: Sat Sep 12, 2009 11:27 am 
Newbie

Joined: Sat Sep 12, 2009 11:21 am
Posts: 5
I'm having the same problem here ( ksert problem)...
------------------------------------------------------
Edit:
I kinda resolved this problem but got another one...i posted i new topic for it.

ksert: try using " to double-quote the name of the columns, tables and schemas.


Top
 Profile  
 
 Post subject: Re: Could not execute JDBC batch update
PostPosted: Thu Sep 02, 2010 6:40 am 
Newbie

Joined: Thu Sep 02, 2010 6:37 am
Posts: 1
I am also getting the same Exception.

org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
at $Proxy7.flush(Unknown Source)
at ca.medavie.hip.common.data.base.daoimpl.BaseDAOImpl.createObject(BaseDAOImpl.java:119)
at ca.medavie.hip.workitemsetup.service.dataaccess.daoimpl.WorkitemSetupDAOImpl.addTask(WorkitemSetupDAOImpl.java:280)
at ca.medavie.hip.workitemsetup.service.dataaccess.daoimpl.testcase.WorkitemSetupDAOImplTest.testaddTask(WorkitemSetupDAOImplTest.java:143)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:515)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1031)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:888)
Caused by: java.sql.BatchUpdateException: ORA-01031: insufficient privileges

at ca.medavie.hip.workitemsetup.service.dataaccess.daoimpl.testcase.WorkitemSetupDAOImplTest.testaddTask(WorkitemSetupDAOImplTest.java:143)
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10656)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 29 common frames omitted


Top
 Profile  
 
 Post subject: Re: Could not execute JDBC batch update
PostPosted: Thu Sep 02, 2010 12:32 pm 
Newbie

Joined: Thu Dec 18, 2008 1:40 pm
Posts: 8
Your actually problem lies in the ORA errror - Caused by: java.sql.BatchUpdateException: ORA-01031: insufficient privileges. You might want grant privilege to the user the operation you are trying to do on the database table.


Top
 Profile  
 
 Post subject: Re: Could not execute JDBC batch update
PostPosted: Fri Sep 03, 2010 4:34 am 
Newbie

Joined: Thu Sep 02, 2010 1:29 pm
Posts: 5
Disable batch at all for test purpose put <property name="hibernate.jdbc.batch_size">0</property> and see what it writes to You. Sometimes batch hide real errors


Top
 Profile  
 
 Post subject: Re: Could not execute JDBC batch update
PostPosted: Wed Nov 17, 2010 1:12 pm 
Newbie

Joined: Wed Nov 17, 2010 12:54 pm
Posts: 2
Cameron McKenzie wrote:
Cameron McKenzie


Hi Cameron

I have the same error and I believe is from the Mapping. I added a new field to the database and to the Mapping file. When I retrieve the data everything is OK. I can see the new field. However If I try to update or insert fields I get the ORA – 01013 Insufficient Privileges error.
Any thoughts please?

ORA – 01013 Insufficient Privileges

" at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)\r\n at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src)\r\n at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()\r\n at NHibernate.AdoNet.OracleDataClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)\r\n at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()\r\n at NHibernate.Persister.Entity.AbstractEntityPersister.ProcessGeneratedProperties(Object id, Object entity, Object[] state, ISessionImplementor session, SqlString selectionSQL, ValueInclusion[] includeds)\r\n at NHibernate.Persister.Entity.AbstractEntityPersister.ProcessInsertGeneratedProperties(Object id, Object entity, Object[] state, ISessionImplementor session)\r\n at NHibernate.Action.EntityInsertAction.Execute()\r\n at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)\r\n at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)\r\n at NHibernate.Engine.ActionQueue.ExecuteActions()\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)\r\n at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)\r\n at NHibernate.Impl.SessionImpl.Flush()\r\n at BNYM.Ark.Entities.Framework.NHibernate.EntityBase.Insert(IEntityInfo entity) in C:\\BNYM\\ARK\\Business\\BNYM.Ark.Business.Entities.Framework\\EntityBase.cs:line 397\r\n at BNYM.Ark.Business.Entities.ReleasePurposeTypeSetEntity.Insert(IReleasePurposeTypeSetInfo entityInfo) in C:\\BNYM\\ARK\\Business\\BNYM.Ark.Business.Entities\\ReleasePurpose\\ReleasePurposeTypeSetEntity.cs:line 104\r\n at BNYM.Ark.Business.Processes.CoreBP.AddReleasePurposeTypeSetBF(IReleasePurposeTypeSetInfo info, ArkContext context) in
C:\\BNYM\\ARK\\Business\\BNYM.Ark.Business.Processes\\ReferenceData.cs:line 1493"



Thank you


Top
 Profile  
 
 Post subject: Re: Could not execute JDBC batch update
PostPosted: Fri Feb 08, 2013 7:57 am 
Beginner
Beginner

Joined: Fri Aug 13, 2004 3:07 pm
Posts: 44
The error is definitely from the grants for the user to the table. YOu have probably given select grants but not insert or update grants

_________________
Thanks
Sameet


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.