Hello, May I ask some questions about Fetch Groups with OpenJPA (using v1.1.0): 1. Is the "default" fetch group ALWAYS active? I was trying to load e.g. only one field from an Entity in a query, but noticed that even if I do fp.resetFetchGroups(); and fp.clearFields(); and then a fp.addField(MyEntity.class, "name"); STILL always includes all columns which I assume are in the Default Fetch Group (all Basic fields, and all direct relations). This took me a moment to figure out, because as I read the Doc in chapter 7, I was assuming that I can entirely control this through the API.. is this intended? To really control exactly what column is in a SELECT fine granuarly under some circumstances, is it fair to say (and may be add to the doc?) that you have to annotate EVERY field as @Basic(fetch=FetchType.LAZY) or @ManyToOne(cascade = CascadeType.PERSIST, fetch=FetchType.LAZY) ? If under other circumstances one then wants the standard fetching behaviour, do you need to create your own myDefaultFetchGroup which explicitly includes all Basic fields + and all direct relations? Seems a bit cumbersome, am I getting something wrong? 2. http://openjpa.apache.org/docs/latest/manual/manual.html#ref_guide_fetch _impl 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 lot's 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). 3. When I do FetchPlan.addField() for a @ManyToMany or a @PersistentCollection(elementEmbedded = true) field, there is no eager fetching (like when the same field has FetchType.EAGER)... Should this work? Can somebody point to any examples or test cases for this? Do we need to fiddle with the EagerFetchMode join/parallel?? 4. Caching: How do FetchGroups and L2 (EMF not EM) Caching relate to each other in OpenJPA? If you do a query with an active FetchGroup that excludes some fields, with active Data Cache, and later another query on the same Entity with another FetchGroup (some columns may be used in both, others not), is the cache a) never used (in other words, query caching uses the Fetch Group as cache key), b) only the "missing" columns are fetched and "merged" ? Thank you very much, Michael
_____________________________ Michael Vorburger, Odyssey Financial Technologies ____________________________________________________________ This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
