-->
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 get table column info when using createSQLQuery
PostPosted: Thu Jun 26, 2008 6:29 am 
Newbie

Joined: Thu Jun 26, 2008 6:17 am
Posts: 1
Hello:

Pardon me if it has been answered before but I could not find
via different searches on Hibernate or Google.


createSQLQuery("select * from A,B where <condition>").iterate()
to get earch row and do processing.
the doc says the above returns Object[], which is great
except that I need to know their column names, which
it would not be practically to use hardcoded mapping of
array index to column names. In other words, how to get
the ResultSetMetaData. Or is there a way to return
a Map<String,String> that the key would be the column name.

I wonder how to get the info within hibernate. I could
get a jdbc connection and do the old jdbc way, but it would
lose the advantage of using hibernate, such as builtin handling
of prepared statements, etc.

Another related question is that would iterate() first creates
the whole list from db and then return the iterator or it would
be a reference to the incoming result sets so that large data
set would not fill the memory.


Thanks in advance.


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.