rzo1 opened a new pull request, #222: URL: https://github.com/apache/openjpa/pull/222
Reported by @ilgrosso while testing Apache Syncope against 4.2.0-SNAPSHOT on PostgreSQL: `@Lob @Convert(converter = ProvisionListConverter.class) private List<Provision> provisions`, with an `AttributeConverter<List<Provision>, String>`, gave a `BYTEA` column, where Syncope 4.1 with `@Lob private String provisions` gave `TEXT`. `@Lob` and `<lob/>` set the column to CLOB for a `String`, `char[]` or `Character[]` attribute and to BLOB otherwise. The mapping parsers do this before the converter is known, and `MappingInfo` keeps that type over the converter's template column. So a converter to `String` on any other attribute type got a BLOB, and a converter to `byte[]` on a `String` got a CLOB. On Derby the insert fails with `XCL12`. This is not new: a converted attribute that is not a collection has the same problem on master and in 4.1.1. OPENJPA-3017 only made the `List` case reachable. `ConverterValueHandler` and `ConverterElementHandler` now change a CLOB or BLOB column to CLOB for a converter to `String` and to BLOB for a converter to `byte[]`. Other database types keep their column type. This covers annotations, mapping files, overrides and auto-applied converters, because the handlers run once the converter is known. A converter to `byte[]` is also read as bytes now; before, the converter was passed a `java.sql.Blob` and failed with "argument type mismatch", with or without `@Lob`. The tests use a `List` converted as a whole, so this PR is based on #220 (OPENJPA-3017) and will move to master once that is merged. Existing tables created with `@Lob` and a converter to `String` have a BLOB column, while the mapping now expects a CLOB. -- 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]
