-->
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.  [ 4 posts ] 
Author Message
 Post subject: problem with named query
PostPosted: Thu Mar 17, 2005 6:22 pm 
Newbie

Joined: Thu Mar 17, 2005 6:16 pm
Posts: 2
Hi,

Using a named query (w/ 2.1.8) which looks as follows:

<sql-query name="findQueries">
<return alias="q" class="com.optimal.nighthawk.queries.Query"/>
SELECT {q}.QUERY_ID AS {q.queryID},
{q}.QUERY_NAME AS {q.name}
FROM PHX_QUERIES {q} WHERE upper({q}.QUERY_NAME) LIKE :criteria
</sql-query>

Its gets executed and fails with the error below... can anyone help me?

2005-03-17 16:34:43 DEBUG net.sf.hibernate.loader.Loader - processing result set
2005-03-17 16:34:43 DEBUG net.sf.hibernate.type.IntegerType - returning '1' as column: QUERY_ID0_
2005-03-17 16:34:43 DEBUG net.sf.hibernate.loader.Loader - result row: 1
2005-03-17 16:34:43 DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 1
2005-03-17 16:34:43 DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: com.optimal.nighthawk.queries.Query#1
2005-03-17 16:34:43 DEBUG net.sf.hibernate.type.StringType - returning 'test query jimmy' as column: QUERY_NAME0_
2005-03-17 16:34:43 DEBUG net.sf.hibernate.util.JDBCExceptionReporter - SQL Exception
java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:6221)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1557)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1482)
at net.sf.hibernate.type.StringType.get(StringType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:67)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:690)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:631)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:590)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:505)
at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:218)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:285)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92)
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3867)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
at com.optimal.nighthawk.queries.QueryDAO.findQueries(Unknown Source)
at com.optimal.nighthawk.queries.QueryManagerDelegate.findQueries(Unknown Source)
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:324)
at flashgateway.adapter.java.JavaBeanAdapter.invokeFunction(JavaBeanAdapter.java:65)
at flashgateway.filter.AdapterFilter.invoke(AdapterFilter.java:117)
at flashgateway.filter.MessageSecurityFilter.invoke(MessageSecurityFilter.java:144)
at flashgateway.filter.ServiceNameFilter.invoke(ServiceNameFilter.java:101)
at flashgateway.filter.EnvelopeFilter.invoke(EnvelopeFilter.java:102)
at flashgateway.filter.SessionFilter.invoke(SessionFilter.java:28)
at flashgateway.filter.LicenseFilter.invoke(LicenseFilter.java:57)
at flashgateway.filter.ErrorFilter.invoke(ErrorFilter.java:39)
at flashgateway.filter.LogFilter.invoke(LogFilter.java:46)
at flashgateway.filter.BatchProcessFilter.invoke(BatchProcessFilter.java:63)
at flashgateway.filter.PacketSecurityFilter.invoke(PacketSecurityFilter.java:68)
at flashgateway.filter.DebugFilter.invoke(DebugFilter.java:38)
at flashgateway.filter.SerializationFilter.invoke(SerializationFilter.java:89)
at flashgateway.Gateway.invoke(Gateway.java:217)
at flashgateway.controller.GatewayServlet.service(GatewayServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:249)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:457)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

_________________
Jimmy G.
Optimal Payments


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 6:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you most likely havent included all columns needed to build your Query object

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: named query error
PostPosted: Fri Mar 18, 2005 10:00 am 
Newbie

Joined: Thu Mar 17, 2005 6:16 pm
Posts: 2
Yes, I am only returning two fields out of 8 in this query instead of the entire object.

So this is not allowed if 8 fields are defined in the object mapping?

_________________
Jimmy G.
Optimal Payments


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 12:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you want to only return a subset of columns then use return-scalar instead.

_________________
Max
Don't forget to rate


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