users@glassfish.java.net

Re: FetchType.EAGER behaviour

From: <glassfish_at_javadesktop.org>
Date: Tue, 25 Sep 2007 00:41:52 PDT

We resolved this issue by creating the query with toplinks api:


        ReadAllQuery raq = new ReadAllQuery(TopLevel.class);
        ExpressionBuilder eb = raq.getExpressionBuilder();

        Expression level1 = eb.anyOf("level1List");
        raq.addJoinedAttribute(level1);
        
        Expression level2 = level1.anyOf("level2List");
        raq.addJoinedAttribute(level2);

        Expression level3 = level2.anyOf("level3List");
        raq.addJoinedAttribute(level3);
    
        Expression level4 = level3.anyOf("level4List");
        raq.addJoinedAttribute(level4);

        Query jpaQuery = new EJBQueryImpl(raq, (EntityManagerImpl)em.getDelegate());
        TopLevel tl = (TopLevel) jpaQuery.getSingleResult();
        return tl;
[Message sent by forum member 'danielcroth' (danielcroth)]

http://forums.java.net/jive/thread.jspa?messageID=236894