-->
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: Hibernate - native SQL query - problems
PostPosted: Tue Apr 17, 2007 4:48 pm 
Newbie

Joined: Sat Dec 02, 2006 1:09 am
Posts: 12
I'm doing a native SQL query against Oracle and the query object says there are no return results but when I do query().list(), I get info that there is an array of chars with one row.

Can anyone tell me why I am getting a single char back? I have a copy of my query below.

I am doing the following:

Query query = session.createSQLQuery(sql);

query object says 0 for "queryReturns" if you put it in a watch

but

List list = query.list() says there is an arrayList of chars. The char returnd is 'X'.

If queryReturns says there are 0 in the query object should there not be 0 rows in the list returned? confusing.


---
String sql =
"SELECT COLLISION_FLAG"
+ " FROM (SELECT 'XCS_COLLISION_FLAG' as COLLISION_FLAG"
+ " FROM CIE.SYNC_QUEUE"
+ " WHERE Rdo_Typ = '" + rdoType + "'"
+ " AND Rdo_Key = '" + rdoKey + "'"
+ " AND Rdo_Change_Gmt >= sysdate - 3"
+ " UNION ALL"
+ " SELECT 'YCS_COLLISION_FLAG' AS COLLISION_FLAG"
+ " FROM CIE.SYNC_TASK"
+ " WHERE Rdo_Typ = '" + rdoType + "'"
+ " AND Rdo_Key = '" + rdoKey + "'"
+ " AND Rdo_Change_Gmt >= sysdate - 3"
+ " UNION ALL"
+ " SELECT 'ZCS_COLLISION_FLAG' AS COLLISION_FLAG"
+ " FROM CIE.SYNC_ARCHIVE"
+ " WHERE Rdo_Typ = '" + rdoType + "'"
+ " AND Rdo_Key = '" + rdoKey + "'"
+ " AND Rdo_Change_Gmt >= sysdate - 3 " + ")"
+ " WHERE ROWNUM = 1";


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.