Eager fetching of children with JDO (Datanucleus)

Posted by Jan on Stack Overflow See other posts from Stack Overflow or by Jan
Published on 2010-06-01T17:11:19Z Indexed on 2010/06/01 17:13 UTC
Read the original article Hit count: 263

Filed under:
|
|

Hi,

can JDO fetch all children of a database model at once? Like:

class Parent {
 @Persistent(mappedBy="parent") 
 private Set<Children> children;
}

class Children {
 @Persistent
 private Parent parent;
 @Persistent
 private String name;
}

In my case, I have a large number of Parents which I fetch at once. Accessing their children then takes a lot of time because they are fetched lazily. Does JDO (Datanucleus) support their fetching at once, togehter with the Parents?

I also tried to fetch all Children independantly with another quey and put them into the Level2 cache afterwards, but still they are fetched (maybe jdo doesn't know about their relationship? Because the ForeignKey (parent-id) hasn't been fetched at first?)

Any ideas how to read the data structure faster?

Cheers,

Jan

© Stack Overflow or respective owner

Related posts about java

Related posts about jdo