Beginner |
 |
Joined: Tue Nov 18, 2003 12:34 am Posts: 39 Location: Dallas, Texas, US
|
Hi,
I recently started using the SQL query and run in the following trouble.
EXCEPTION:
========
java.sql.SQLException: Bad column name: TEST_ID0_
at com.quadcap.sql.ItemsCursor.<init>(ItemsCursor.java:90)
at com.quadcap.sql.SelectExpression.getCursor(SelectExpression.java:227)
at com.quadcap.sql.SelectStmt.execute(SelectStmt.java:76)
at com.quadcap.sql.Session.doStatement(Session.java:264)
at com.quadcap.jdbc.PreparedStatement.execute(PreparedStatement.java:186)
at com.quadcap.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:223)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:83)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:794)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:188)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.jav
at net.sf.hibernate.loader.Loader.doList(Loader.java:949)
at net.sf.hibernate.loader.Loader.list(Loader.java:940)
at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92)
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3628)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
MAPPING:
=======
<class
name="eg.StudentTest"
table="Table1"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="Test_ID"
type="int"
unsaved-value="any"
>
<generator class="assigned">
</generator>
</id>
...
JAVA SOURCE:
=========
Query sqlQuery = session.createSQLQuery("select {test.id} from TABLE1 as {test}", "test", StudentTest.class)
I think it is reading the mapped column name as "Test_ID0_" instead of "Test_ID"... Ultimately, I want to do a aggregate sum(test.id)...
If I am doing something wrong, please help with that. I greatly appreciate your time.
Madhan.
|
|