Post from 25 August 2008 by Craig. > http://openjpa.apache.org/docs/latest/manual/manual.html#ref_guide_fetch_im > pl says that "Even when a direct relation is not eagerly fetched, > OpenJPA selects the foreign key columns and caches the values. This way > when you do traverse the relation, OpenJPA can often find the related > object in its cache, or at least avoid joins when loading the related > object from the database." - that's very kind, but may be we have an > Entity with lots of foreign key columns and I KNOW I only want a list > showing a few attributes, and I KNOW that the direct relations won't be > traversed (say because the Entites are detached, may be). Is there any > way to configure OpenJPA to NOT eagerly fetch direct relations, unless > they are explicitly part of the Fetch Group? Actually what I'd want is > to be able to by default not include foreign key columns, but have a way > to explicitly include them - which is not the same as having the field > as part of the FetchGroup (that will lead to a JOIN, I may just want to > control whether or not to selects the foreign key column). > > Currently we don't have the notion in JDO of fetching key values of > relationships, just fetching the targets of these keys. > Would it be useful to consider adding to the JDO specification the > ability to specify fetching the keys for relationships and not the > relationships themselves? This would probably include adding some > metadata to fetch-group and to FetchGroup.
Just seen a need for this also, bit late I know ;-) Perhaps add something in JDO3.1 ? -- Andy DataNucleus (http://www.datanucleus.org)