You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Michael Wiles (JIRA)" <ji...@apache.org> on 2018/07/10 09:35:00 UTC
[jira] [Commented] (OPENJPA-2668) CriteriaQuery instances should
not change their state based on Query instances created from them
[ https://issues.apache.org/jira/browse/OPENJPA-2668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538314#comment-16538314 ]
Michael Wiles commented on OPENJPA-2668:
----------------------------------------
Hi Mark... thanks for the input.
I am keen to take up this issue as it seems we're at a stand still.. Please, if you don't mind, can you provide a little more detail if you can on what should be happening... i.e. the correct mechanism to do it with openjpa?
> CriteriaQuery instances should not change their state based on Query instances created from them
> ------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-2668
> URL: https://issues.apache.org/jira/browse/OPENJPA-2668
> Project: OpenJPA
> Issue Type: Bug
> Components: jpa
> Affects Versions: 2.4.1
> Reporter: Oliver Gierke
> Assignee: Mark Struberg
> Priority: Major
>
> 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|https://jira.spring.io/browse/DATAJPA-969], 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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)