Solved

Retrieving data generated in a HQL query

Posted on 2006-10-23
1
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet example 11 77
junit example issue 2 59
Java array 10 89
Java Inharitance subclass/child extends, reference variable from base/parent class 9 72
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses

752 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