Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Using a fetch group with find(Fetch groups and the entity manager's find operation)
Using a fetch group with find [message #632653] Wed, 13 October 2010 17:36 Go to next message
Chris  is currently offline Chris Friend
Messages: 2
Registered: October 2010
Junior Member
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 14:34 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
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
Previous Topic:em.remove throws exception: identifier is too long
Next Topic:C++ wth Msqyl-- dyld: Library not loaded: libmysqlcppconn.5.dylib.No image found
Goto Forum:
  


Current Time: Fri Apr 19 08:11:29 GMT 2024

Powered by FUDForum. Page generated in 0.03158 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top