-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem using createNativeQuery using a resultClass
PostPosted: Fri Aug 02, 2013 4:50 am 
Newbie

Joined: Fri Aug 02, 2013 4:15 am
Posts: 3
Hi all, I'm a new Hibernate user.
I've this problem while invoking the createNativeQuery method using the resultClass:

Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][10150][10300][4.14.113] Invalid parameter: Unknown column name CREATIONDATETIME. ERRORCODE=-4460, SQLSTATE=null

What I'm trying to do is to use the createNativeQuery(java.lang.String sqlString, java.lang.Class resultClass) method.

The select I perfom is:
Query vQuery1 = iEntityManager.createNativeQuery("SELECT Name, Description FROM ABSOUTQUEUE where name = 'OUT1'", ABSOutQueueBean.class);
List<?> vList1 = vQuery1.getResultList();

My ABSOUTQUEUE table more columns, the ABSOutQueueBean class has mapped the whole table columns.

If in my select I select all table columns, the query works fine and returns a List of ABSOutQueueBean objects with all attributes set.

But if in my select I try to have only a subset of columns I've the error ERRORCODE=-4460, it seems that persistence
frameworks tryes to find out in resultset all columns defined in the Bean.

So my question is:
Does it possible to use createNativeQuery(java.lang.String sqlString, java.lang.Class resultClass) method
to have only a subset of table columns and providing in resultClass parameter the bean that has all the
table columns attributes?

I expect to have as result a list of resulstClass object with the only attribute listed in select set by framework.

Thanks in advance for your time.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.