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 Listing the query results
PostPosted: Wed Nov 15, 2006 12:38 am 
Newbie

Joined: Wed Nov 15, 2006 12:12 am
Posts: 2
Hi

The follwoing code works fine with Oracle.But it gives error with DB2

Query queryToGetTheAppDefn = session.createQuery(" ");//Query

// to get the totalows in the table
ScrollableResults scrollableResults = query.scroll();
scrollableResults.last();
totalRows = scrollableResults.getRowNumber() + 1;

// To fetch specified number of records
query.setFirstResult((Integer.parseInt(currentPage)-1)*Integer.parseInt(rowPerPage));
query.setMaxResults(Integer.parseInt(rowPerPage));
return new ListingWrapper(totalRows,query.list());


With DB2 it gives the following error. Am including trace :

Caused by: com.ibm.db2.jcc.b.SqlException: Invalid data conversion: Parameter instance aa is invalid for requested conversion to java.sql.Timestamp.
at com.ibm.db2.jcc.b.q.l(q.java:1697)
at com.ibm.db2.jcc.b.r.L(r.java:1083)
at com.ibm.db2.jcc.b.ad.getTimestamp(ad.java:861)
at org.jboss.resource.adapter.jdbc.WrappedResultSet.getTimestamp(WrappedResultSet.java:430)
at org.hibernate.jdbc.ResultSetWrapper.getTimestamp(ResultSetWrapper.java:245)
at org.hibernate.type.TimestampType.get(TimestampType.java:28)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:80)
at org.hibernate.persister.entity.BasicEntityPersister.hydrate(BasicEntityPersister.java:1680)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:523)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:502)
at org.hibernate.loader.Loader.getRow(Loader.java:467)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:165)
at org.hibernate.loader.Loader.doQuery(Loader.java:235)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:114)
at org.hibernate.loader.Loader.doList(Loader.java:912)


Can anyone please help me out in this issue. I am stuck at this point and not able to proceed any furthur

Thanks
Sridevi


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.