rzo1 opened a new pull request, #220: URL: https://github.com/apache/openjpa/pull/220
Reported on the dev list by @ilgrosso, testing Syncope master against 4.2.0-SNAPSHOT: `@Convert` on a `List` attribute whose converter is declared `AttributeConverter<List<X>, Y>`. Such a converter converts the attribute as a whole, so the attribute is basic and belongs in one column. OpenJPA instead found no persistence strategy for it, left it out of the mapping, and lost its contents without raising anything — only one warning among several hundred of the same kind in a full run. The element handler for collections was already there; the attribute never reached it. Three places decide this, and all three only ever asked the type code: - `PersistenceMetaDataDefaults.getPersistenceStrategy()` now treats a converter of the attribute's own type as a strategy, i.e. `BASIC`, as the last resort before giving up on the field. - `parseBasic()` no longer serializes or rejects a collection in that case, since the converter maps the value. - `MappingRepository.defaultTypeStrategy()` and `FieldMetaData.isValueConverted()` admit a collection or map whose converter takes the whole value, which gives it `ConverterValueHandler` and a single column. The discriminator is the converter's own declaration, read from `AttributeConverter<X,Y>`: `X` assignable from the attribute type means the value is converted as a whole, `X` being the element type leaves the existing element-wise path untouched. `FieldMetaData.resolveConverterTypeArgument()` is the generalisation of the resolver that already read `Y`. Out of scope: element-wise conversion of a collection of a non-basic type, which the specification defines for `@Convert` on an `@ElementCollection` and which OpenJPA does not support yet — its enhancer demands metadata for the element type. Worth its own issue. Both tests fail without the production change, verified by reverting it: `the converted attribute must be mapped`, and `expected:<2> but was:<0>` for the round trip. Conversion, enhance, meta, simple and embed packages run 621/29/39 on Derby and on H2, against 619/29/39 on master at the same base with an identical list of failing classes, so the two new tests are the only difference. The unit tests of the three changed modules are green: kernel 145, jdbc 75, persistence 34. -- 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]
