[
https://issues.apache.org/jira/browse/OPENJPA-3106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Richard Zowalla updated OPENJPA-3106:
-------------------------------------
Description:
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.
was:Found while reviewing OPENJPA\-3104.
> 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)