-->
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.  [ 2 posts ] 
Author Message
 Post subject: Intermittent error using Hibernate in AS400
PostPosted: Tue May 19, 2009 5:44 am 
Newbie

Joined: Tue May 19, 2009 4:56 am
Posts: 2
Hi all,
We have this issue we are encountering when executing a query using hibernate named queries in AS400.

Here is the query:
Code:
Query query = session.getNamedQuery("com.rrd.comn.db.OrderItemAdditionalData.forOrderItem");
query.setInteger("orderNumber", td.getOrderNumber());
query.setInteger("orderDate", td.getOrderDate());
query.setInteger("orderItemRecordNumber", td.getOrderItemRecordNumber());
OrderItemAdditionalData jiad = (OrderItemAdditionalData) query.uniqueResult();


Here is the mapping file for OrderItemAdditionalData
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>
  <class name="com.rrd.comn.db.OrderItemAdditionalData" table="tableName">
    <composite-id>
      <key-property name="orderNumber" column="cola" type="integer" />
      <key-property name="orderDate" column="colb" type="integer" />
      <key-property name="orderItemRecordNumber" column="colc" type="integer" />
    </composite-id>
      
    <property name="usPrice" column="cold" type="big_decimal" />
    <property name="customerCode" column="cole" type="string" />
  </class>
   
  <query name="com.rrd.comn.db.OrderItemAdditionalData.forOrderItem">
    <![CDATA[
      FROM com.rrd.comn.db.OrderItemAdditionalData
      WHERE orderNumber = :orderNumber
      AND orderDate = :orderDate
      AND orderItemRecordNumber = :orderItemRecordNumber
    ]]>         
  </query>      
</hibernate-mapping>


This query is executed hundreds of times (in a multi-threading environment) and it usually executes successfully. But SOMETIMES we get the exception:

org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: com.ibm.db2.jdbc.app.DB2JDBCException: An undefined column name was detected.(please let me know if i should put the whole stack trace)

I'm out of ideas as to why this is happening. I hate intermittent errors the most. I hope someone can help me. Please let me know if i need to post additional info.

Thanks so much.

PS - We are using Java 1.3 by the way.


Top
 Profile  
 
 Post subject: Re: Intermittent error using Hibernate in AS400
PostPosted: Fri May 22, 2009 3:25 am 
Newbie

Joined: Tue May 19, 2009 4:56 am
Posts: 2
Here is the stack trace of the error:

Error occured while processing transaction. org.hibernate.exception.SQLGrammarException: could not execute query
org.hibernate.exception.SQLGrammarException: could not execute query
at java.lang.Throwable.<init>(Throwable.java:195)
at java.lang.RuntimeException.<init>(RuntimeException.java:43)
at org.hibernate.exception.NestableRuntimeException.<init>(NestableRuntimeException.java:128)
at org.hibernate.HibernateException.<init>(HibernateException.java:22)
at org.hibernate.JDBCException.<init>(JDBCException.java:25)
at org.hibernate.exception.SQLGrammarException.<init>(SQLGrammarException.java:31)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2216)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
at com.rrd.poller.helper.OrderStatusHelper.buildOrderItem(OrderStatusHelper.java:571)
at com.rrd.poller.helper.OrderStatusHelper.build(OrderStatusHelper.java:76)
at com.rrd.poller.handler.Handler870.handle(Handler870.java:29)
at com.rrd.poller.poller.AbstractPoller$HandlerRunner.run(AbstractPoller.java:115)
at java.lang.Thread.run(Thread.java:534)
Caused by: com.ibm.db2.jdbc.app.DB2JDBCException: An undefined column name was detected.
at java.lang.Throwable.<init>(Throwable.java:195)
at java.lang.Exception.<init>(Exception.java:41)
at java.sql.SQLException.<init>(SQLException.java:40)
at com.ibm.db2.jdbc.app.DB2JDBCException.<init>(DB2JDBCException.java:151)
at com.ibm.db2.jdbc.app.DB2ResultSet.findColumn(DB2ResultSet.java:920)
at com.ibm.db2.jdbc.app.DB2ResultSet.getString(DB2ResultSet.java:7936)
at org.hibernate.type.StringType.get(StringType.java:18)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2101)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
... 13 more

Thanks again.


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