-->
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: HibernateJdbcException: SQL command not properly ended
PostPosted: Thu Nov 20, 2008 5:26 am 
Newbie

Joined: Fri Dec 07, 2007 5:02 am
Posts: 4
Location: Haugesund, Norway
Hi.

We're using Quartz scheduling engine for synchronisation between external data and into our application. The query run by the scheduled jobs encounter an exception when ran from our weblogic production server, but not from my localhost. I get an SQLException: SQL command not properly ended in production.

Please, anyone, HELP? This is a real headscratcher for me...

Below you can find the hibernate mapping xml, the generated query and the full exception:
Sample.hbm.xml
Code:
<hibernate-mapping default-access="field" >
  <class name="no.gassco.track.domain.sampleManager.Sample" table="SAMPLE" where="status not like 'S'" >
    <id name="id" type="string" column="ID_NUMERIC" length="10" />
    <property name="sampleDate" type="timestamp" column="SAMPLED_DATE" length="7" />
    <property name="status" type="string" column="STATUS" length="1" />
    <property name="cargo" type="string" column="CARGO" length="8" />
    <many-to-one name="location" cascade="none" lazy="false" column="LOCATION_ID" />
    <many-to-one name="samplePoint" cascade="none" lazy="false" column="SAMPLING_POINT" />
    <!-- Associations -->
    <join table="TEST" fetch="select" >
      <subselect>
        select T.SAMPLE       AS sample,
               T.ORDER_NUM    AS testOrder,
               R.NAME         AS componentName,
               R.VALUE        AS numValue,
               R.TEXT         AS textValue,
               R.UNITS        AS unit,
               T.ANALYSIS
          from Test T, Result R
         where T.TEST_NUMBER = R.TEST_NUMBER
           and R.TEXT not like ' '
      </subselect>
      <key column="SAMPLE" />
      <property name="testOrder" type="string" column="testOrder" length="10" />
      <property name="numValue" type="double" column="numValue" length="126" />
      <property name="textValue" type="string" column="textValue" length="234" />
      <property name="unit" type="string" column="unit" length="10" />
      <property name="analysis" type="string" column="ANALYSIS" length="10" />
      <property name="component" type="string" column="componentName" length="40" />
    </join>
  </class>
</hibernate-mapping>


Query generated by hibernate
I've tested that all bind-variables are included in the query.
Code:
select this_.ID_NUMERIC as ID1_150_0_,
       this_.SAMPLED_DATE as SAMPLED2_150_0_,
       this_.STATUS as STATUS150_0_,
       this_.CARGO as CARGO150_0_,
       this_.LOCATION_ID as LOCATION5_150_0_,
       this_.SAMPLING_POINT as SAMPLING6_150_0_,
       this_1_.testOrder as testOrder151_0_,
       this_1_.numValue as numValue151_0_,
       this_1_.textValue as textValue151_0_,
       this_1_.unit as unit151_0_,
       this_1_.ANALYSIS as ANALYSIS151_0_,
       this_1_.componentName as componen7_151_0_
  from SAMPLE this_ inner join (
        select T.SAMPLE       AS sample,
               T.ORDER_NUM    AS testOrder,
               R.NAME         AS componentName,
               R.VALUE        AS numValue,
               R.TEXT         AS textValue,
               R.UNITS        AS unit,
               T.ANALYSIS
          from Test T, Result R
         where T.TEST_NUMBER = R.TEST_NUMBER
           and R.TEXT not like ' '
       ) this_1_ on this_.ID_NUMERIC=this_1_.SAMPLE
where ( this_.status not like 'S')
   and this_.SAMPLING_POINT=?
   and this_.LOCATION_ID=?
   and this_1_.ANALYSIS=?
   and this_1_.componentName=?


Exception from prod server
Code:
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL[
  … SQL from above …
]; SQL state [HY000]; error code [933]; could not execute query; nested exception is org.hibernate.exception.GenericJDBCException: could not execute query; nested exception is org.hibernate.exception.GenericJDBCException: could not execute query]
        at no.gassco.track.util.job.SampleManagerSynchronizer.execute(SampleManagerSynchronizer.java:199)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:531)

Caused by: org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.GenericJDBCException: could not execute query
        at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:627)
        at no.gassco.track.dao.SampleManagerDaoImpl.getSamples(SampleManagerDaoImpl.java:177)
        at no.gassco.track.service.SampleManagerServiceImpl.getSamples(SampleManagerServiceImpl.java:116)
        at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
        at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy236.getSamples(Lno.gassco.track.domain.sampleManager.SamplePoint;Lno.gassco.track.domain.sampleManager.Location;Lno.gassco.track.domain.sampleManager.Component;)Ljava.util.List;(Unknown Source)
        at no.gassco.track.util.job.SampleManagerSynchronizer.execute(SampleManagerSynchronizer.java:161)
        ... 2 more

Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
        at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.doList(Loader.java:2208)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2102)
        at org.hibernate.loader.Loader.list(Loader.java:2097)
        at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:96)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1573)
        at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
        at no.gassco.track.dao.SampleManagerDaoImpl.getSamples(SampleManagerDaoImpl.java:155)
        at no.gassco.track.service.SampleManagerServiceImpl.getSamples(SampleManagerServiceImpl.java:116)
        at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
        at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

Caused by: java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00933: SQL command not properly ended
        at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
        at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
        at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Unknown Source)
        at weblogic.jdbc.base.BaseStatement.commonExecute()V(Unknown Source)
        at weblogic.jdbc.base.BaseStatement.executeQueryInternal()Ljava.sql.ResultSet;(Unknown Source)
        at weblogic.jdbc.base.BasePreparedStatement.executeQuery()Ljava.sql.ResultSet;(Unknown Source)
        at weblogic.jdbcx.base.BasePreparedStatementWrapper.executeQuery()Ljava.sql.ResultSet;(Unknown Source)
        at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:97)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:184)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1785)
        at org.hibernate.loader.Loader.doQuery(Loader.java:674)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.doList(Loader.java:2205)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2102)
        at org.hibernate.loader.Loader.list(Loader.java:2097)
        at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:96)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1573)
        at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
        at no.gassco.track.dao.SampleManagerDaoImpl.getSamples(SampleManagerDaoImpl.java:155)
        at no.gassco.track.service.SampleManagerServiceImpl.getSamples(SampleManagerServiceImpl.java:116)
        at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
        at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2008 6:58 pm 
Newbie

Joined: Fri Dec 07, 2007 5:02 am
Posts: 4
Location: Haugesund, Norway
Please, I could really use some help on this one.

Below, you can also find my hibernate.cfg.xml:
Code:
<hibernate-configuration>
<session-factory>
<!-- ===================================================
        Hibernate configuration
===================================================
  -->
  <property name="hibernate.hbm2ddl.auto">update</property>
  <property name="hibernate.bytecode.use_reflection_optimizer">true</property>
  <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
  <property name="hibernate.generate_statistics">true</property>
  <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
  <property name="hibernate.show_sql">true</property>
  <property name="hibernate.format_sql">false</property>

<!-- Mapping resources -->
  <mapping resource="no/gassco/track/domain/sampleManager/Sample.hbm.xml" />

</session-factory>
</hibernate-configuration>


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.