Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Using Fetch-Group with Many-to-One(where to put Fetch-Group in orm.xml?)
Using Fetch-Group with Many-to-One [message #1070242] Wed, 17 July 2013 14:28
Hannes Kühtreiber is currently offline Hannes KühtreiberFriend
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!

[Updated on: Thu, 25 July 2013 05:51]

Report message to a moderator

Previous Topic:ERROR - Predicate "OR" is NULL --solved
Next Topic:Read operation returns me old value before commit. Why?
Goto Forum:

Current Time: Tue May 22 12:17:15 GMT 2018

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

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

Back to the top