-->
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.  [ 3 posts ] 
Author Message
 Post subject: (sql-query) 3.2.cr3: invalid column name. 3.2.cr2: works ok!
PostPosted: Thu Sep 13, 2007 8:06 am 
Newbie

Joined: Thu Feb 12, 2004 11:52 am
Posts: 6
Hibernate version:
Test case works OK with hibernate-3.2.0.cr2
Same test case doesn't works with hibernate-3.2.0.cr3

Mapping documents:
<sql-query name="GET_QUICK_CIF_SP" callable="true">
<return alias="CustomerInfo" entity-name="CustomerInfo">

<return-property name="memberId" column="QCIF_MEMBER_ID"/>
<return-property name="customerNumber" column="QCIF_CUSNO"/>
<return-property name="customerShortDescription" column="QCIF_TEXTS"/>
<return-property name="domicile" column="QCIF_DOMICILE"/>
<return-property name="referenceCurrency" column="QCIF_CURRENCY"/>
<return-property name="customerCategory" column="QCIF_CATEGORY"/>
<return-property name="branch" column="QCIF_BRANCH"/>
<return-property name="legalForm" column="QCIF_LEGALFORM"/>
<return-property name="institutionalCustomer" column="QCIF_INSTITUTIONAL"/>
<return-property name="internalCustomer" column="QCIF_IS_USER"/>
<return-property name="correspondenceLanguage" column="QCIF_LANGUE_PUB"/>
<return-property name="nationality" column="QCIF_NATIONALITY"/>
<return-property name="dateOfBirth" column="QCIF_BIRTHDATE"/>
<return-property name="gender" column="QCIF_SEX"/>
<return-property name="accountManager" column="QCIF_MANAGER"/>
<return-property name="status" column="QCIF_ACTIVE"/>
<return-property name="openDate" column="QCIF_OPENDATE"/>
<return-property name="modifyDate" column="QCIF_MODDATE"/>
<return-property name="modifyUser" column="QCIF_MODUSER"/>

</return>
{ ? = call vegasqu.P_Cifsca_Get.GET_QUICK_CIF(?,?,?,?) }
</sql-query>

Code between sessionFactory.openSession() and session.close():
Object [] params = {searchQuery, langue, memberId, maxResults };
customerInfos = getHibernateTemplate().findByNamedQuery("GET_QUICK_CIF_SP", params);


Full stack trace of any exception that occurs:
only with hibernate-3.2.0.cr3 I have the following error:
org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not execute query; bad SQL grammar [{ ? = call vegasqu.P_Cifsca_Get.GET_QUICK_CIF(?,?,?,?) }]; nested exception is java.sql.SQLException: Invalid column name
Caused by: java.sql.SQLException: Invalid column name
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3295)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1914)
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1563)
at org.hibernate.type.IntegerType.get(IntegerType.java:28)
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.type.ComponentType.hydrate(ComponentType.java:506)
at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:229)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:1088)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:553)
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:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
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:913)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:369)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:904)
at evega.cbo.cmd.reference.dao.hibernate.CustomerManagerDaoHibernate.findCustomersShort(CustomerManagerDaoHibernate.java:102)
at evega.cbo.test.cmd.HibernateEvegaTestCase.testfindCustomersShort(HibernateEvegaTestCase.java:435)
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 org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
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 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


Name and version of the database you are using:
Oracle
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Oracle JDBC driver
10.2.0.1.0

The generated SQL (show_sql=true):
2007-09-13 13:42:38,265 DEBUG [main] (AbstractBatcher.java:393) - { ? = call vegasqu.P_Cifsca_Get.GET_QUICK_CIF(?,?,?,?) }
Hibernate: { ? = call vegasqu.P_Cifsca_Get.GET_QUICK_CIF(?,?,?,?) }


Debug level Hibernate log excerpt:
2007-09-13 13:42:38,250 INFO [main] (HibernateEvegaTestCase.java:433) - start findCustomersShort stored procedure with Hibernate
2007-09-13 13:42:38,265 DEBUG [main] (AbstractBatcher.java:393) - { ? = call vegasqu.P_Cifsca_Get.GET_QUICK_CIF(?,?,?,?) }
Hibernate: { ? = call vegasqu.P_Cifsca_Get.GET_QUICK_CIF(?,?,?,?) }
2007-09-13 13:42:38,500 INFO [main] (NullableType.java:132) - could not read column value from result set: QCIF1_358_0_; Invalid column name
2007-09-13 13:42:39,109 WARN [main] (JDBCExceptionReporter.java:71) - SQL Error: 17006, SQLState: null
2007-09-13 13:42:39,109 ERROR [main] (JDBCExceptionReporter.java:72) - Nome colonna non valido
2007-09-13 13:42:39,203 ERROR [main] (CustomerManagerDaoHibernate.java:110) - METHOD = evega.cbo.cmd.reference.dao.hibernate.CustomerManagerDaoHibernate.findCustomersShort()
ERRORDESC = Exception executing the stored procedure.
EXCEPTION = org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not execute query; bad SQL grammar [{ ? = call vegasqu.P_Cifsca_Get.GET_QUICK_CIF(?,?,?,?) }]; nested exception is java.sql.SQLException: Invalid column name


Hi all,
we have a very strange error:
Our test case is able to use a DAO to call a store procedure and to map the returning resultsets to a list of CustomerInfo objects using both hibernate 3.1.3 and hibernate 3.2.0.cr2.

When we try to run the same test case using hibernate 3.2.0.cr3 or above (tested also with 3.2.0.ga, 3.2.1.ga, 3.2.3.ga and 3.2.4.ga) it doesn't work because it says "Invalid column name"

Reading in the forum I've seen many people having this error but none of them had their code working with older hibernate versions.

I've also seen a lot of messages explaining that hibernate needs all the columns returned to be mapped by the entity object. I think we are mapping all the columns. Can it be that older hibernate version don't execute this check?

Any idea about what else could cause this problem?
Maybe can you tell me a good place in hibernate code where I can debug to understand which columns is he receiving and which is not valid?

thanks in advance,
Federico


Top
 Profile  
 
 Post subject: Same bug?
PostPosted: Thu Sep 13, 2007 8:57 am 
Newbie

Joined: Thu Feb 12, 2004 11:52 am
Posts: 6
Can this issue be linked to this JIRA task?

http://opensource.atlassian.com/project ... e/HHH-2159

I see the problem started from hibernate-core-3.2.0.cr3

has somebody an hibernate .jar with this patch applied and published somewhere? ;-)


thanks again,
Federico


Top
 Profile  
 
 Post subject: patch not working
PostPosted: Thu Sep 13, 2007 9:50 am 
Newbie

Joined: Thu Feb 12, 2004 11:52 am
Posts: 6
Hi,
I tested patching the hibernate jar with the code of the JIRA task above but the error remains the same...

any idea?

thanks,
Federico


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