23
I am working on hibernate in eclipse. I am executing simple 'From' query. Here is the code
List list = sess1.createQuery("From Myview").list();
System.out.println("Records Found :"+list.size());
Iterator<Myview> i = list.iterator();
while(i.hasNext())
{
Myview nS = i.next();
System.out.println(nS.getFirstName()+" -- "+nS.getLastName()+" -- "+nS.getAddressLine1());
}
The problem is the list.size() returns 11, which is right as i have 11 records in my table. But when i am in while loop, the same records shown multiple times and the loop termintes after 11th iteration. here is my output

here is what i want

Now you can see that in my output, record is displayed 11 times but the same record is repeated again and again. And what i need is the output displayed in the later image.
Kindly help me in this regard, as i am new to hibernate