Queries that return tuples in Hibernate by R4R Team

Hibernate queries sometimes return tuples of objects.. Each tuple is returned as an array:

Iterator kittensAndMothers = session.createQuery("select kitten, mother from Studnet kitten join kitten.mother mother")
            .list()
            .iterator();

while ( kittensAndMothers.hasNext() ) 
{
    Object[] tuple = (Object[]) kittensAndMothers.next();
    Student kitten = (Student) tuple[0];
    Student mother = (Student) tuple[1];
    ....
}
Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!