Using a fetch group with find [message #632653] |
Wed, 13 October 2010 13:36  |
Eclipse User |
|
|
|
Hi,
I'm using eclipselink 2.0 and I can't figure out how to add a fetch group to a find.
I'm calling:
myEntityManger.find(MyTable.class, idMyTble);
Doing a normal named query I can set a fetch group with the hint method...but I don't see how to set the fetch group with the find.
Any insight would be most appreciated.
|
|
|
Re: Using a fetch group with find [message #632873 is a reply to message #632653] |
Thu, 14 October 2010 10:34  |
Eclipse User |
|
|
|
Hello,
Try the new to JPA find methods that take map of properties, for example:
FetchGroup fg = new FetchGroup();
fg.addAttribute("firstName");
fg.addAttribute("lastName");
HashMap properties = new HashMap(1);
properties.put(QueryHints.FETCH_GROUP, fg);
Employee resultEmployee = em.find(Employee.class, id, properties);
Best Regards,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.06312 seconds