Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving Hibernate query result as result set instead of list

Heya, I m new to hibernate. I have to say it really simplifies everything for the SQL query. However, manipulating the returned result is a headache for me at the moment.

The result is returned as list. Most of the time I really want the result to be in result set so that I can manipulate it easier as using result set, you can specifies value by column name or index. In List, I am pretty much owned by own noobity.

In some ocassion, I can retrieve the list into a JSF data table and then just call the member directly. I cannot always do this. Don't ask me why. @.@ spinning head.

Is there a way to get resultset instead of list for hibernate?

like image 871
Haikal Nashuha Avatar asked Mar 14 '11 09:03

Haikal Nashuha


1 Answers

Slightly old thread but I cannot resist:

    // Code for iterating over a list of objects
    for(MappedClass mappedCless : list){
        String name = mappedClass.getName();
        String id = mappedClass.getId();
        // further logic
    }
like image 56
DABrake Avatar answered Oct 16 '22 17:10

DABrake