-->
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.  [ 9 posts ] 
Author Message
 Post subject: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Tue Oct 26, 2010 9:47 am 
Newbie

Joined: Tue Oct 26, 2010 9:22 am
Posts: 5
Hi,
I am getting the following error .. i couldn't resolve it. please try to give me the solution for this.


Code:
2010-10-19 04:11:35,392 [WARN ] JDBCExceptionReporter.logExceptions(77) - SQL Error: -99999, SQLState: null
2010-10-19 04:11:35,392 [ERROR] JDBCExceptionReporter.logExceptions(78) - Non-atomic batch failure.  The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.
2010-10-19 04:11:35,408 [WARN ] JDBCExceptionReporter.logExceptions(77) - SQL Error: -301, SQLState: 42895
2010-10-19 04:11:35,408 [ERROR] JDBCExceptionReporter.logExceptions(78) - Error for batch element #0: DB2 SQL error: SQLCODE: -301, SQLSTATE: 42895, SQLERRMC: 2
2010-10-19 04:11:35,408 [WARN ] JDBCExceptionReporter.logExceptions(77) - SQL Error: -301, SQLState: 42895
2010-10-19 04:11:35,408 [ERROR] JDBCExceptionReporter.logExceptions(78) - Error for batch element #1: DB2 SQL error: SQLCODE: -301, SQLSTATE: 42895, SQLERRMC: 2
2010-10-19 04:11:35,408 [WARN ] JDBCExceptionReporter.logExceptions(77) - SQL Error: -301, SQLState: 42895
2010-10-19 04:11:35,408 [ERROR] JDBCExceptionReporter.logExceptions(78) - Error for batch element #2: DB2 SQL error: SQLCODE: -301, SQLSTATE: 42895, SQLERRMC: 2
2010-10-19 04:11:35,408 [WARN ] JDBCExceptionReporter.logExceptions(77) - SQL Error: -301, SQLState: 42895
2010-10-19 04:11:35,408 [ERROR] JDBCExceptionReporter.logExceptions(78) - Error for batch element #3: DB2 SQL error: SQLCODE: -301, SQLSTATE: 42895, SQLERRMC: 2
2010-10-19 04:11:35,408 [WARN ] JDBCExceptionReporter.logExceptions(77) - SQL Error: -301, SQLState: 42895
2010-10-19 04:11:35,408 [ERROR] JDBCExceptionReporter.logExceptions(78) - Error for batch element #4: DB2 SQL error: SQLCODE: -301, SQLSTATE: 42895, SQLERRMC: 2
2010-10-19 04:11:35,408 [WARN ] JDBCExceptionReporter.logExceptions(77) - SQL Error: -301, SQLState: 42895
2010-10-19 04:11:35,408 [ERROR] JDBCExceptionReporter.logExceptions(78) - Error for batch element #5: DB2 SQL error: SQLCODE: -301, SQLSTATE: 42895, SQLERRMC: 2
2010-10-19 04:11:35,408 [ERROR] AbstractFlushingEventListener.performExecutions(301) - Could not synchronize database state with session
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:249)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87)
   at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:218)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2220)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2650)
   at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:52)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
   at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
   at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1562)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
   at org.springframework.orm.hibernate3.HibernateTemplate$35.doInHibernate(HibernateTemplate.java:979)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
   at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:969)
   at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:962)
   at com.dao.impl.InputMessageDAOHibernate.getInputMessageById(InputMessageDAOHibernate.java:43)
   at sun.reflect.GeneratedMethodAccessor513.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
   at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
   at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:104)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)


Thanks,
Bhagavathy Vinoth


Top
 Profile  
 
 Post subject: Re: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Tue Oct 26, 2010 11:44 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
SQLSTATE 42895: For static SQL, an input host variable cannot be used, because its data type is not compatible with the parameter of a procedure or user-defined function.


Top
 Profile  
 
 Post subject: Re: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Wed Oct 27, 2010 12:52 am 
Newbie

Joined: Tue Oct 26, 2010 9:22 am
Posts: 5
I have checked with data type compatibilities both hbm and bean.Eventhough Its all working code.

Basically I get an error on Hibernate findByCriteria() method with only one condition (i.e. ID=13123).

I suspect some synchronize database state with session.

please conclude this issue. its urgent to complete.


Thanks,
Bhagavathy


Top
 Profile  
 
 Post subject: Re: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Wed Oct 27, 2010 6:09 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
bhagavathy.vinoth wrote:
I have checked with data type compatibilities both hbm and bean.Eventhough Its all working code.

Basically I get an error on Hibernate findByCriteria() method with only one condition (i.e. ID=13123).

I suspect some synchronize database state with session.

please conclude this issue. its urgent to complete.


Thanks,
Bhagavathy


Please specify your condition. This may happen, for example, if your parameter value is too large.


Top
 Profile  
 
 Post subject: Re: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Wed Oct 27, 2010 11:33 am 
Newbie

Joined: Tue Oct 26, 2010 9:22 am
Posts: 5
Code:
DetachedCriteria inputMessageCriteria = DetachedCriteria.forClass(Inputmsg.class);
inputMessageCriteria.add(Restrictions.eq("Id", Id));
...
...
List inputMessages = getHibernateTemplate().findByCriteria(inputMessageCriteria); // here it throws error
....


Top
 Profile  
 
 Post subject: Re: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Wed Oct 27, 2010 11:36 am 
Newbie

Joined: Tue Oct 26, 2010 9:22 am
Posts: 5
For Example condition value may be

Code:
inputMessageCriteria.add(Restrictions.eq("Id", 10391));


Top
 Profile  
 
 Post subject: Re: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Thu Oct 28, 2010 10:13 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
What is ID column type?


Top
 Profile  
 
 Post subject: Re: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Mon Nov 01, 2010 11:42 am 
Newbie

Joined: Tue Oct 26, 2010 9:22 am
Posts: 5
Hi all,
Thanks for reply.. and i found some interesting changes...

Our table has column type of char. and hbm mapping for that column is Long.

when this case the error throws...

If i change the hbm column from Long to String then Hibernate initialization fails.
(i.e) It says error of Hibernate mapping has error so sessionfactory couldn't initialize.

I wonder how comes this possible please let me know yours thought...

Thanks
Bhagavathy Vinoth.


Top
 Profile  
 
 Post subject: Re: SQLGrammarException: Could not execute JDBC batch update
PostPosted: Tue Nov 02, 2010 4:39 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
Did you forget to change your class also?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.