Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2
Mapping documents:
<sql-query name="fetchDependencyForTask">
<return alias="rcmTask"
class="Task">
<return-property name="systemCode" column="sub_sys_cod"/>
<return-property name="taskCode" column="tsk_cod"/>
<return-property name="taskStatus" column="stat_cod"/>
<return-property name="lastModified" column="lst_mod_dt"/>
<return-property name="soFar" column="duration"/>
<return-property name="lastTime" column="lst_duration"/>
<return-property name="eta" column="eta"/>
<return-property name="instanceNumber" column="prcr_inst"/>
<return-property name="taskNumber" column="sts_inl_no"/>
</return>
{ callsp_fe_getDpyForTask (?,?)}
</sql-query>
Full stack trace of any exception that occurs:
2007-11-22 15:28:36,946 [main] WARN org.hibernate.util.JDBCExceptionReporter [] - SQL Error: 0, SQLState: S0022
2007-11-22 15:28:36,946 [main] ERROR org.hibernate.util.JDBCExceptionReporter [] - S0022: Invalid column name 'stt5_60_0_'.
2007-11-22 15:28:37,009 [main] ERROR com.bnpparibas.risk.collateralrisk.dao.RcmTaskDao [] - Failedt to fetch Dependency For Task MY_TASK
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
Caused by:
org.hibernate.exception.SQLGrammarException: could not execute query
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:2214)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
at org.springframework.orm.hibernate3.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:906)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:897)
at com.bnpparibas.risk.collateralrisk.dao.BaseDao.executeStoredProcedure(BaseDao.java:80)
at com.bnpparibas.risk.collateralrisk.dao.RcmTaskDao.fetchDependencyForTask(RcmTaskDao.java:179)
at com.bnpparibas.risk.collateralrisk.dao.RcmTaskDaoTest.testFetchDependencyForTask(RcmTaskDaoTest.java:270)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:65)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:24)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
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:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.sql.SQLException: S0022: Invalid column name 'stt5_60_0_'.
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc3.tds.TdsResultSet.findColumnByLabel(Unknown Source)
at com.sybase.jdbc3.jdbc.SybResultSet.findColumn(Unknown Source)
at com.sybase.jdbc3.jdbc.SybResultSet.getString(Unknown Source)
at org.hibernate.type.StringType.get(StringType.java:18)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2046)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1371)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1299)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
... 33 more
Name and version of the database you are using:
Sybase 12.5
The generated SQL (show_sql=true):
{ call sp_fe_getDpyForTask (?,?)}
Debug level Hibernate log excerpt:
Hi all,
i am getting that disaster exception when calling stored procedure via sql native query.
Or, let's be precise. I have 15 sql-native queries that calls stored procedures.
10 works, and 5 does not, and the common trait between the five failing is that they are doing some operations with dates. (below is sybase code)
set lst_duration = datediff(mi,r.stt_dt,r.end_dt)
, eta = dateadd (mi,datediff(mi,r.stt_dt,r.end_dt),t.lst_mod_dt )
and all of those are returning same error
Invalid column name 'stt5_60_0_'
i guess that column is somehow the product of doing date differences..
ALL stored procedure that fails are all doing the same thing with dates
i was wondering if anyone came across this before, and what could be the solution...
anyone could help?
thanks and regards
marco