openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Vorburger" <mvorbur...@odyssey-group.com>
Subject RE: Fetch Group questions
Date Fri, 12 Sep 2008 10:34:08 GMT
Pinaki,

Finally extending slightly beyond my previous "Wow" only response (thanks, amazing turn around!)
:

>  Let me know if you can try the recent changes and whether it addresses your use case.

I built a 1.3.0-SNAPSHOT from SVN and hereby confirm it addresses the use case initially posted;
and https://issues.apache.org/jira/browse/OPENJPA-704.  Once again, thanks a lot for your
follow-up and this improvement.

Working further on our stuff using Fetch Groups (basically a 'model-driven' layer on top -
one day I should make some slides about this...), we have come up with another fun use case
though, a similar scenario as before, something where the current OpenJPA FetchGroup API appears
too limited / not fine-grained enough.  Here is an example:

class B { String name; String address; }
class A { B mother; B child; }

Now suppose one would like to build a fetch group with only "child"'s name and "mother"'s
address. If you use a fetch plan with the following fields:

addField(A.class, child)
addField(B.class, name)
addField(A.class, mother)
addField(B.class, address)

the result would be {A.child, A.child.name, A.child.address, B.mother, B.mother.name, B.mother.address}...
unless I'm missing something, it doesn't currently seem possible to avoid to fetch A.child.address
and B.mother.name, agreed?  

I guess from an API point of view, you would need to be able to specify addField(A.class,
child.name) and addField(A.class, mother.address)?  There are probably other ways one could
build an API allowing configuring this, but allowing "relationship traversal" in FetchGroups
would seem most natural, to me.  However I'm not sure what this would imply OpenJPA internally
for you? Is a solution feasible?

BTW: Does anybody know if the JPA 2.0 JSR includes an OpenJPA FetchGroup-like API into the
standard JPA API?  If yes, hopefully it will cover the kind of stuff we're discussing here!

Regards,
Michael


-----Original Message-----
From: Pinaki Poddar [mailto:ppoddar@apache.org] 
Sent: lundi, 25. août 2008 19:21
To: users@openjpa.apache.org
Subject: RE: Fetch Group questions


Hi Michael,
  Yes, the field inclusion in fetch group is determined by the field's name with the declaring
class and not by the defining class. 

 The recent commit 688777, adds the behavior you want. So 
   FetchPlan.addField(A.class, "b");
   FetchPlan.addField(B.class, "code");
 should fetch {A.b, A.b.code} but not {A.code}.

 I have added a JIRA issue to track [1].

 Let me know if you can try the recent changes and whether it addresses your use case.

 Regards --

[1] https://issues.apache.org/jira/browse/OPENJPA-704
[2]
http://n2.nabble.com/svn-commit%3A-r688777---in--openjpa-trunk-openjpa-kernel-src-main-java-org-apache-openjpa%3A-kernel-FetchConfigurationImpl.java-meta-FieldMetaData.java-tc781976.html



--
View this message in context: http://n2.nabble.com/Fetch-Group-questions-tp534861p782029.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

____________________________________________________________

• 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.

Mime
View raw message