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

CriteriaQuery instances should not change their state based on Query instances created from them

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.4.1
    • None
    • jpa
    • None

    Description

      JPA has a two-step, programatic query creation process: first, you create a CriteriaQuery to build up the general query structure, add constraints on it etc. Then you take that instance and create a (Typed)Query instance from it using the currently available EntityManager and bind parameters to it.

      According to reports we got for Spring Data JPA, the latter step changes the state of the CriteriaQuery instance, so that subsequent creations of Query instances from it (and subsequent parameter bindings in turn) don't actually get applied correctly.

      Even if the subsequent creation and parameter binding got applied, that change of state in CriteriaQuery instances is problematic in concurrent access scenarios as the bindings might override each other partially.

      Generally speaking I'd recommend to keep the CriteriaQuery instances immutable with regards to the creation of Query instances from them and the subsequent handling of those Query instances.

      Attachments

        Activity

          People

            struberg Mark Struberg
            oliver.gierke Oliver Drotbohm
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h