-->
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.  [ 2 posts ] 
Author Message
 Post subject: Native SQL retrieving column names
PostPosted: Wed Jun 13, 2012 6:47 am 
Newbie

Joined: Mon Dec 21, 2009 8:51 am
Posts: 6
I'v been trying to find a solution for this via google but didn't find anything, so I hope that there is a way to resolve my problem.

I have written a java application where ther user can enter some arbitrary SQL and export the result to various different outputs like simple CSV file export, export as insert statement etc.. Due to this, the statement is not known in advance. Now I used a result transformer to obtain the column names from the select, which worked fine. However, since some of the queries return a large number of records, thus resulting in a huge memory usage, I wanted to rewrite this to use a cursor and immediately write each record when it is delivered from the database, instead of waiting for the complete select to finish. So now I'm using ScrollableResults to fetch the rows individually and this part works. However, I have no idea how to retrieve the column names now, because the result transfomer is not fired anymore. I don't understand why though, because I would have expected that the result transfomer should be called for each row, no matter how the row is retrieved. So either I'm doing something wrong, or I missing something.

I would really appreciate it if there were any help for this. Thanks!


Top
 Profile  
 
 Post subject: Re: Native SQL retrieving column names
PostPosted: Thu Jun 14, 2012 8:08 am 
Newbie

Joined: Wed Jun 13, 2012 7:29 am
Posts: 3
Hello, sorry for bumping but i'm really interested in an answer to this question myself.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.