[ 
https://issues.apache.org/jira/browse/OPENJPA-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18115569#comment-18115569
 ] 

ASF subversion and git services commented on OPENJPA-2961:
----------------------------------------------------------

Commit e51f03d744b40ad72e3ac9931e8ce920f2d20ba7 in openjpa's branch 
refs/heads/OPENJPA-2961 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=e51f03d74 ]

[OPENJPA-2961] Restrict a predicate over a TREAT path to the treated type

A TREAT(x AS Type) path in a WHERE clause only overrode the metadata of the
path, so rows of other types matched a predicate on an attribute they share
with the treated type. As defined by the specification, such a predicate is
now false if x is not an instance of Type or one of its subclasses. The
restriction is added to the predicate containing the TREAT path, so other
branches of an OR are not affected.


> TREAT discriminator filter excludes subclasses of target
> --------------------------------------------------------
>
>                 Key: OPENJPA-2961
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2961
>             Project: OpenJPA
>          Issue Type: Sub-task
>          Components: jpa
>    Affects Versions: 4.2.0
>            Reporter: Maxim Solodovnik
>            Priority: Major
>             Fix For: 4.2.0
>
>
> Discussion thread: 
> https://github.com/apache/openjpa/pull/144#discussion_r3683001854
> **(medium)** `appendTreatDiscriminator` emits `disc = <treated class value>` 
> only. Per JPA, `TREAT(x AS Middle)` must also match subtypes of Middle, so 
> for a 3-level hierarchy this incorrectly filters out instances of Middle's 
> subclasses - it should be an IN over the discriminator values of the treated 
> class and all mapped subclasses. It also only handles `cols[0]` of the 
> discriminator.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to