rzo1 opened a new pull request, #336: URL: https://github.com/apache/openjpa/pull/336
https://issues.apache.org/jira/browse/OPENJPA-3106 An `AttributeConverter` that returns a different column value for the same attribute on each call (e.g. encryption with a random salt or IV) made an attribute converted as a whole (a collection, a map or an object) dirty at every flush. An unchanged instance was updated each time, and after a JPQL bulk or native `DELETE` removed its row the next flush failed with an `OptimisticLockException`. This affected enhanced entities too. Cause: the OPENJPA-3019 check compares the column value saved at load or flush with a fresh `convertToDatabaseColumn()` of the current attribute. Fix (`StateManagerImpl.isWholeConvertedChanged`, used by the flush check, merge, the data cache and the rollback restore): - Equal column values: unchanged, as before. Deterministic converters stop here and cost the same as before. - Different column values: the attribute is converted again. If both conversions agree, the field changed (OPENJPA-3019 behaviour). If they disagree, the saved column value is converted back and compared with the attribute by `equals()`, as Hibernate does. Behaviour change: a change made in place to state that `equals()` of the attribute type (or of its elements) does not cover is no longer written for such converters. `openjpa.Compatibility=CompareConvertedValuesByEquals=false` writes these attributes at every flush as before. Documented in the 4.3.0 migration considerations and the upgrade notes. Not covered: a type without `equals()` behind such a converter is still written at every flush. Tests: `TestNonDeterministicConverter` (13), `TestNonDeterministicConverterDataCache` (1), `TestNonDeterministicObjectConverterEquals` (6, default) and `TestNonDeterministicObjectConverter` (3, option off). The OPENJPA-3019 tests (`TestConvertedInPlaceChange`) and all `TestConverted*` pass. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
