I'm not sure I can help, but I may have seen some similar performance problems in my code. What is the query you use? What do you mean by class C is not eagerly fetched?
>From your post I assume that you are querying for an A object. In my case when >I did that, some related objects (like C in your case) are fetched, but with >way too many queries than you would use when hand writing the queries. So do you really mean that C is not yet fetched when querying for A or do you mean that when you query for A you can see from OpenJPA's trace that C is fetched with way too many queries (N + 1 select problem)? Henno -----Oorspronkelijk bericht----- Van: Sirisha Chiruvolu [mailto:chsiri...@gmail.com] Verzonden: zaterdag 3 november 2012 16:03 Aan: users@openjpa.apache.org Onderwerp: Re: Fetchgroups recursion problem I have below domain classes @FetchGroup(name="Group1", attributes={ @FetchAttribute(name="aCase") }) Class A{ @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="CASE_UID", nullable=false, insertable=false, updatable=false) private ClassB aCase..... } Class B{ @OneToMany(mappedBy = "aCase", fetch = FetchType.Lazy) private List<Class C> caseList;... } Class C{ ... } Class Test{ OpenJPAEntityManager oem = OpenJPAPersistence.cast(em); em.clear(); oem.getFetchPlan().setMaxFetchDepth(3).addFetchGroup("Group1"); } My problem is Class C records are not getting eagerly fetched, there are sperate queries that are getting fired . I want to fetch all the records in a single query. Can anyone help me.. OpenJPAQuery q1=oem.createQuery(statement.toString()); -- View this message in context: http://openjpa.208410.n2.nabble.com/Fetchgroups-recursion-problem-tp3874382p7581598.html Sent from the OpenJPA Users mailing list archive at Nabble.com.