Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2176

QuerySQLCache not processing prepared sql correctly

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.1, 2.1.2, 2.2.1, 2.3.0
    • None
    • query
    • None

    Description

      Opening this JIRA on behalf of a user e-mailing me with this question... The workaround for this problem is to disable the QuerySQLCache either via a property in the persistence.xml or on an individual query basis via the setQueryHint invocation. A description of the problem follows:

      I have a JPQL like this:
      SELECT catentry FROM CatalogEntry catentry WHERE catentry.catalogEntryId IN(:catalogEntryId)

      • catalogEntryId is of type long.
      • I am trying to set the named query parameter 'catalogEntryId' from my code using query.setParameter("catalogEntryId", list of catalogEntryIds)
      • I am ensuring that the list of catalogEntryIds that I am setting is always a list of type java.lang.Long. I am using wrappers/objects rather than primitives. But I think that should be OK, as the same is mentioned in the OpenJPA manual.

      The issue is:

      • When I start my server (on WAS), it works fine for the very first time. So let's say I pass 10459 & 10460 as catalogEntryIds, I get the entities corresponding to both the ids.
      • But for subsequent requests, only one entity is returned mostly for the last id(10460) in the list. There are no errors/exceptions thrown. I have in fact started the server in debug mode and checked the exact values set in the query object. The "boundParams" in the QueryImpl has the list of catalogEntryIds(10459 & 10460) that I have set.
      • The issue is even more strange when I try to set a list of entities using the IN() expression in another query which takes a list of entities as the query parameter. It works for the very first time and then for subsequent requests it throws an exception saying parameter not supported/ invalid parameter...

      Another strange behavior is that all the above works absolutely fine, when I launch the similar code in a stand alone J2SE platform, typically using a JUNIT test case.

      This problem looks very basic for a J2EE environment, I am hoping this is a known issue and you have a fix already?
      About my environment:

      • I am running with 1.0.0.5 of the OSGi/JPA 2.0 Feature Pack on top of WAS v7
      • I have also set dataCache/queryCache to false hoping that would yield successful result, but did not help. Seems like they are by default disabled?

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            helenxu Helen Xu
            kwsutter Kevin W. Sutter

            Dates

              Created:
              Updated:

              Issue deployment