-->
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: How to use createSQLQuery to get result as String[]
PostPosted: Tue Apr 10, 2007 9:30 pm 
Newbie

Joined: Tue Apr 10, 2007 9:06 pm
Posts: 1
Hi,
I am using Oralce 10g and Hibernate 3.2.
My table tableA has column id defined as char(24) type, and column last_update_date as Date type, I hope date can show time field.

When I code as :
Code:
Query query = session
            .createSQLQuery("select id, last_update_date ts from ltableA where rownum <= 1");
List<Object[]> result = query.list();


the id has only one CHAR, and ts has only yyyy-mm-dd to be shown.

and if :


Code:
Query query = session
            .createSQLQuery("select id, last_update_date ts from ltableA where rownum <= 1")
.addScalar("id", Hibernate.STRING).addScalar("ts", Hibernate.TIMESTAMP);
List<Object[]> result = query.list();


result is as respected.

My question is:

if I want use
Code:
select * from tableA
...
List<String[]> result = query.list();

and force all field of char mapping to String, and all field of Data as Timestamp.

How can I?

Thanks!


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.