Solved

Retrieving data generated in a HQL query

Posted on 2006-10-23
1
255 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

617 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