The problem could be due to fetch depth. In my jdoconfig.xml file, I
have
<property name="datanucleus.maxFetchDepth" value="1"/>
which is the default value.
I use transactions for my data exchange with the datastore using JDO
for everything except queries which can return entities from more than
one entity group.
What I do is:
· Retrieve or get an instance of A.
· "Touch" = retrieve the instance of B from A (A.getB()?)
· "Touch" = retrieve the instance of C from B (B.getC()?)
whilst in the transaction and before detaching. Then you should have
what you need.
What I do (and it's not optimised but it works) is have a generalised
business method like
/**
* For each object in the list supplied, fetches explicitly all
fields
* which represent either persistent objects or lists (of any
object),
* in order to force their loading into the persistent object.
* This method traverses one generation only in each direction.
* (To traverse another generation, a fresh call to the database
* will be needed to yield the relevant object(s) from the correct
* source generation.)
* @param liList The list of persistence objects to be traversed.
*/
private static void fetchChildAndParentFields(ArrayList liList)
{
ListIterator iterList = liList.listIterator();
while (iterList.hasNext())
{
Object obj = iterList.next();
if (obj instanceof User)
{
User user = (User)obj;
ArrayList<UserDetails> liUserDetails = user.getUserDetails();
if (liUserDetails != null)
liUserDetails.size();
ImageDataTemp idtImageDataTemp = user.getImageDataTemp();
ArrayList<CommissionReceived> liCommissionsReceived =
user.getCommissionsReceived();
if (liCommissionsReceived != null)
liCommissionsReceived.size();
}
else if ...
...
}
}
which is called within the transaction before detachment. I then know
that I have got the next layer of objects already fetched and ready
for use and abuse.
On Apr 7, 1:19 pm, Neto <[email protected]> wrote:
> I have a mistake above: by
>
> I retrieve a "A" object and than detach it. I can acess the listB field just
> fine, but when i try to acess the* working hours*, i get the following
> error:
>
> e mean
>
> I retrieve a "A" object and than detach it. I can acess the listB field just
> fine, but when i try to acess the *listC*, i get the following error:
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.