fetch group question
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache JDO Project > fetch group question




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    fetch group question  
Karan Malhi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-15-07 06:11 AM

For a PC object like

class Person{
String firstName;
String lastName;
String address;
}

Currently I can set a named fetch-group in the .jdo file and add it in
the fetch plan. It would've been great if I would've been able to do
the following:

Query query = pm.newQuery(Person.class);
FetchGroup criteria = new FetchGroup();
criteria.add("firstName").add("lastName");
query.getFetchPlan().clearGroups().addGroup(fg);

Is there a way I can do something like the above (dynamic fetch
groups) with the current spec?
If not, do you think something like this is worth adding to the future
release of JDO?
Would be great to have something like this.

I know that I could project some fields using:
query.setResult("firstName, lastName");
query.setResultClass(Value.class);

public class Value{
String firstName;
String lastName;
}

But the problem here is that Value is not really a PC class.

Any help would be appreciated.

Thanks!

--
Karan Singh Malhi






[ Post a follow-up to this message ]



    Re: fetch group question  
Karan Malhi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-15-07 06:11 AM

Sorry,

The code should read as:
Query query = pm.newQuery(Person.class);
FetchGroup criteria = new FetchGroup(Person.class);
// or I could also do
// FetchGroup criteria = new FetchGroup(query);

criteria.add("firstName").add("lastName");
query.getFetchPlan().clearGroups().addGroup(criteria);

On 10/14/07, Karan Malhi <karan.malhi@gmail.com> wrote:
> For a PC object like
>
> class Person{
>     String firstName;
>     String lastName;
>     String address;
> }
>
> Currently I can set a named fetch-group in the .jdo file and add it in
> the fetch plan. It would've been great if I would've been able to do
> the following:
>
> Query query = pm.newQuery(Person.class);
> FetchGroup criteria = new FetchGroup();
> criteria.add("firstName").add("lastName");
> query.getFetchPlan().clearGroups().addGroup(fg);
>
> Is there a way I can do something like the above (dynamic fetch
> groups) with the current spec?
> If not, do you think something like this is worth adding to the future
> release of JDO?
> Would be great to have something like this.
>
> I know that I could project some fields using:
> query.setResult("firstName, lastName");
> query.setResultClass(Value.class);
>
> public class Value{
>    String firstName;
>    String lastName;
> }
>
> But the problem here is that Value is not really a PC class.
>
> Any help would be appreciated.
>
> Thanks!
>
> --
> Karan Singh Malhi
>


--
Karan Singh Malhi






[ Post a follow-up to this message ]



    Re: fetch group question  
Matthew Adams


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-15-07 06:11 PM

Hi Karan,

Currently, there is no standardized way to dynamically define fetch
groups.  We'll look into adding this to the specification.  You might
consider requesting this of your current JDO vendor.

Thanks for your feedback!

Sincerely,
Matthew

On Oct 14, 2007, at 7:43 PM, Karan Malhi wrote:

> Sorry,
>
> The code should read as:
> Query query = pm.newQuery(Person.class);
> FetchGroup criteria = new FetchGroup(Person.class);
> // or I could also do
> // FetchGroup criteria = new FetchGroup(query);
>
> criteria.add("firstName").add("lastName");
> query.getFetchPlan().clearGroups().addGroup(criteria);
>
> On 10/14/07, Karan Malhi <karan.malhi@gmail.com> wrote: 
>
>
> --
> Karan Singh Malhi







[ Post a follow-up to this message ]



    Re: fetch group question  
Joerg von Frantzius


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-15-07 06:11 PM

A workaround could be to define a fetch group for every single field in
the .jdo file, and then assembling the desired combination at runtime (I
remember somebody having done that before).

Karan Malhi schrieb:
> Sorry,
>
> The code should read as:
> Query query = pm.newQuery(Person.class);
> FetchGroup criteria = new FetchGroup(Person.class);
> // or I could also do
> // FetchGroup criteria = new FetchGroup(query);
>
> criteria.add("firstName").add("lastName");
> query.getFetchPlan().clearGroups().addGroup(criteria);
>
> On 10/14/07, Karan Malhi <karan.malhi@gmail.com> wrote:
> 
>
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:32 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register