File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Object Relational Mapping
Hibernate eager fetching issue
Joined: Aug 25, 2009
Oct 17, 2011 05:56:07
I am newbie to hibernate
i have a self refrencing class user having one to many relation
i am using association table for one to many
i have 4 users having following records
following records are there in association table
when i am using lazy fetching and using criteria query to fetch user 1
its giving me 1 record and when i get childs its giving me 3 records that is working fine
BUT when i change it to eager
It is giving me thrice record 1
Joined: Oct 10, 2010
Oct 17, 2011 07:45:39
please give me complete model class then I shall give a solution for Eager fetching related data from orm .
Joined: Oct 17, 2011
Oct 17, 2011 16:57:08
The following should solve your problem:
Session ss = hibernateUtil.getSession();
Criteria crit = ss.createCriteria(Whatever.Class);
I agree. Here's the link:
subject: Hibernate eager fetching issue
Hibernate POJOs -- association or no-association ?
Hibernate Mapping (Many-To-One Association). Problem. This forum is my last hope.
hibernate:many-to-many the association table is not getting populated
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014