openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henno Vermeulen <>
Subject questions about FetchAttribute recursionDepth
Date Tue, 05 Apr 2011 15:42:09 GMT
I have a ProductCategory entity with a reference to a parent ProductCategory. I wish to eagerly
fetch one parent but not the parent's parent. We always use fetchplans (using entityManager.getFetchPlan().addFetchGroups(...))
and we always detach according to the fetchplan, so I tried:

@FetchGroup(name = "ProductCategoryParentNoRecursion", attributes = { @FetchAttribute(name
= "parent", recursionDepth = 1) })

Question 1: according to the latest manual a recursionDepth of 1 is the default, but I have
also seen it mentioned in Jira or the newsgroup that it was changed so that the recursion
depth has no limit by default. Which one is it?

Question 2: no matter what recursionDepth I use (I tried -1, 0, 1 and 2), it always fetches
the parent's parent. I tested this with a ProductCategory structure of A -> B -> C.
When I use entityManager.find to find C by it's id, I expect C.parent.parent to be null but
it is not. Why is this?
(I did not access the parent before detaching).


Henno Vermeulen
Huize Molenaar

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message