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 13:36 Go to next message
Chris  is currently offline Chris
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 10:34 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1016
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: Thu Jul 24 19:03:04 EDT 2014

Powered by FUDForum. Page generated in 0.01723 seconds