Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9256533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:57:59+00:00 2026-06-18T11:57:59+00:00

I have my pojo classes Master: public class Master extends RecordSet{ private String empcode;

  • 0

I have my pojo classes

Master:

public class Master extends RecordSet{

private String empcode;
private String empname;
private String dept;

public String getEmpcode() {
    return empcode;
}
public void setEmpcode(String empcode) {
    this.empcode = empcode;
}
public String getEmpname() {
    return empname;
}
public void setEmpname(String empname) {
    this.empname = empname;
}
public String getDept() {
    return dept;
}
public void setDept(String dept) {
    this.dept = dept;
}

DateRange:

public class DateRange extends RecordSet {
    private String  ddate;

    public String getDdate() {
        return ddate;
    }

    public void setDdate(String ddate) {
        this.ddate = ddate;
    }
}

RecordSet:

public class RecordSet {
    private DateRange daterange;
    private Master master;  

public DateRange getDaterange() {
        return daterange;
    }
    public void setDaterange(DateRange daterange) {
        this.daterange = daterange;
    }
    public Master getMaster() {
        return master;
    }
    public void setMaster(Master master) {
        this.master = master;
    }

}

I have my HibernateCode:

 SQLQuery query = session
                    .createSQLQuery("CALL AbsentReportproc(:_fromdate,:_todate)");
            query.addEntity(Master.class);
            query.addEntity(DateRange.class);
            query.setParameter("_fromdate", "2012-12-03");
            query.setParameter("_todate", "2012-12-04");

            List<Object[]> obj = query.list();
            System.out.println(obj);
            List<RecordSet> recordset = new ArrayList<RecordSet>();
            Iterator it = obj.iterator();
            while (it.hasNext()) {
                Object[] object = (Object[]) it.next();
                for (int i = 0; i < object.length; i++) {

    RecordSet set = (RecordSet) object[i];
     recordset.add(set);
        System.out.println(set);
//Here I am able to print
//edu.model.Master@15093f1
//edu.model.DateRange@e6f7d2
//edu.model.Master@19836ed
//edu.model.DateRange@3e0ebb
//edu.model.Master@39443f
//edu.model.DateRange@e6f7d2 etc................

                }
            }

    }

My Requirement is to display the results from both(Master and DateRange) in a jsp using JSTL Tags

Could any one How can I get final List object to iterate and display results from both pojo’s

I want to display EmployeeName,Code,Dept from Master Pojo and ddate from DateRange Pojo?

when I iterate the RecordSet list then I’m not able to print the values(getting Null Pointer Exception)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:58:01+00:00Added an answer on June 18, 2026 at 11:58 am

    You could do something like this:

    <c:forEach var="record" items="${recordset}">
        <c:out value="${record.master.empcode}" />
        <c:out value="${record.master.empname}" />
        <c:out value="${record.master.dept}" />
        <c:out value="${record.daterange.ddate}" />
    </c:forEach>
    

    EDIT:

    List<Object[]> obj = query.list(); 
    List<RecordSet> recordset = new ArrayList<RecordSet>(); 
    for (Object[] item: obj) {
        Master master = null;
        DateRange dateRange = null;
        if (item[0] instanceof Master) {
            Master master = (Master) item[0];
            DateRange dateRange = (DateRange) item[1];
        } else if (item[0] instanceof DateRange) {
            DateRange dateRange = (DateRange) item[0];
            Master master = (Master) item[1];
        }
        RocordSet record = new RecordSet();
        record.setMaster(master);
        record.setDateRange(dateRange);
        recordset.add(record);
    }
    

    And the return the recordset object to the jsp.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have POJO classes: class Ticket { private int id; private double cost; private
I have a POJO that uses a service to do something: public class PlainOldJavaObject
I have the following POJO: public class SampleBean1 { @Id @GeneratedValue(generator = system-uuid) @GenericGenerator(name
I'm using annotation for named query in hibernate.I have two classes a POJO class
I have used hibernate ant tool to generate hibernate pojo classes with annotations. What
In my project I have a small data structure Key . public class Key
I have the following calls in one of my classes @Override public Integer save(NewsItem
I have a pojo class ( Location ) which have a property as @Collection(jcrType=nt:map)
Via reflection I have found a lists of properties from x POJO classes which
I have class name in string variable model , so I want to cast

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.