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.
|