Solved

Retrieving data generated in a HQL query

Posted on 2006-10-23
1
251 Views
Last Modified: 2006-11-18
How do I retrieve the results of a Query, in Hibernate, that returns multiple object types in the resultset. I am trying to run the following query:

   Select
        l.trackingNumber.retrieveLocalSource(),
        l.queue.getGroup().retrieveRootParentGroup(),
        l.Leads
   From
        ROSLeadImports l
   Where l.leadDT between ? and ?

With the first column being of type Source, the second of type Groups, and the last is an Integer. I have been able to retrieve data when I would run something like "From ROSLeadImports l Where l.leadDT between ? and ?" by running the iterate() function on the Query and casting the resulting objects to type ROSLeadImports; but what if I have a objects with various types?
0
Comment
Question by:rufassa
1 Comment
 
LVL 8

Accepted Solution

by:
reach2piyush earned 250 total points
ID: 17793016

List qryList = query.list();

for (Iterator iter = qryList.iterator(); iter.hasNext();)
{
            Object[] objArray = (Object[]) iter.next();

            Source src = (Source) objArray[0];
            Groups groups = (Groups) objArray[1];
            Integer leads = (Integer) objArray[2];
}
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
netstat -ano | find "8000" and taskkill /f /pid 2984 3 57
javap bin 2 34
iterator/ListIterator approach 17 27
CSV file parsing thru Java 13 31
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question