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

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

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

[OPENJPA-3106] Compare a value of a non-deterministic converter by equals

A converter that converts the same value differently on each call made
an attribute converted as a whole dirty at every flush. Compare it with
the value converted back from the saved column value instead.
CompareConvertedValuesByEquals=false restores the previous behaviour.

Generated-by: Claude Code (Opus 5.5)


> Non-deterministic AttributeConverter makes an unchanged field dirty on every 
> flush
> ----------------------------------------------------------------------------------
>
>                 Key: OPENJPA-3106
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-3106
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Richard Zowalla
>            Priority: Minor
>             Fix For: 4.3.0
>
>
> An AttributeConverter whose convertToDatabaseColumn() returns a different 
> value for the same attribute on every call, for example an encrypting 
> converter with a random IV or salt, makes OpenJPA see the field as changed on 
> every flush. An unchanged instance is updated each time, and after a JPQL 
> bulk DELETE (or native DELETE) removed its row, the next flush fails with an 
> OptimisticLockException.
> This happens for enhanced entities too. The likely cause is the check of 
> whole-converted fields (OPENJPA-3019, dirtyCheckWholeConverted), which 
> compares the database values of the current attribute and the loaded one. 
> Comparing the attribute values (or the value as last read from or written to 
> the database) instead of converting again would avoid it.
> Found while reviewing OPENJPA-3104.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to