Using Fetch-Group with Many-to-One [message #1070242] |
Wed, 17 July 2013 14:28 |
Hannes Kühtreiber Messages: 21 Registered: June 2013 |
Junior Member |
|
|
Hello Everybody,
I have to access fairly big object graphs with several many-to-one relations.
To avoid n+1 selects I tried to use
query.setHint("eclipselink.batch", "...");
This however results in a "SELECT DISTINCT"-statement, which fails because the class on the other end of the relation has blob attributes.
(text on SQL Server)
Is it possible to fetch only a few attributes of the related objects? I'd only need the name anyway.
I tried to add a named fetch group to the orm.xml of either the class itself or the related class, but I cannot get it to work.
So here my questions:
-is this possible at all?
-where would I have to declare the fetch-group and how do I access it from another class?
-is this sensible or are there better ways?
Sorry if this is a stupid question but I was unable to find an example that works!
Hannes
[Updated on: Thu, 25 July 2013 05:51] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02837 seconds