Dear Hibernate users,
I have a conceptual question regarding the eager fetch. In the tutorial example, I noticed that within a session transaction, I can write either
Person aPerson = (Person) session.load(Person.class, personId)
or
Person aPerson = (Person) session
.createQuery("select p from Person p left join fetch p.events where
p.id = :pid")
.setParameter("pid", personId)
.uniqueResult();
The later one is mentioned as eager fetch. I wonder what is the difference between the two approaches of fetching the person object, given its id?
Any clarification or explanation is deeply appreciated.
Jackie
|