3 Replies Latest reply on Oct 31, 2007 8:02 AM by pmuir

    framework:entity-query called on pages that don't use it?

      I've been looking at the console log for my site and I've notice that the framework:entity-queries from web.xml are being called on some pages where there is no reference to the query name. It seems to only happen the first time that the page is loaded. I'm wondering if this is normal behaviour or should I be looking into my code somewhere to fix it?

        • 1. Re: framework:entity-query called on pages that don't use it
          pmuir

          Not normal. Are you sure you have no reference to it in pages.xml somehow?

          • 2. Re: framework:entity-query called on pages that don't use it

            So I've been digging about in my code and have discovered that the reason for these queries is not related to web.xml, it's just coincidence that similar queries are defined there. It's actually related to a particular Entity bean (and Entity beans in general I guess). I run a query which returns types of this Entity bean and it seems the extra queries are run for each field of the entity which is a join to another table and has the annotation:

            @NotFound(action=NotFoundAction.IGNORE)

            Removal of this annotation stops the queries from running but of course leads to an error when there's an entry in the table that doesn't have a corresponding value in the joined table.

            So I guess now I ask if this is normal behaviour of @NotFound :-)

            • 3. Re: framework:entity-query called on pages that don't use it
              pmuir

              I guess its doing an initial query to see if any records can be found and then building the query correctly. But ask on the JPA forum.