> On Jun 9, 2020, at 5:54 PM, John Huss <johnth...@gmail.com> wrote:
> 
> 2) Regarding skipping parsing when just going straight back out again to
> serialization - I have felt the reluctance (like you) of parsing this in
> those cases. But one thing to think about is that the parser/serializer
> (let's say Jackson in this case) may have special rules for how types are
> outputted like pretty/minified, sorted/unsorted, string/number (for
> BigDecimal). So skipping that parse/serialization may not actually be
> desirable, at least not in every case.

Was discussing this offline with Nikita and stumbled on what can be a good 
solution:

1. Cayenne would provide a set of "unparsed" wrapper types (Wkt, Json, etc.) 
and the JDBC/SQL machinery around them (ExtendedType, SqlTreeProcessor).
2. A user who needs a parsed version would create their own types (e.g. 
WktParsed, JsonParsed), and would connect them to Cayenne via a custom 
ValueObjectType [1] (e.g. ValueObjectType<WktParsed, Wkt>).

Such a two-tier approach would allow the users to map persistent properties to 
anything they want without much effort and use their preferred third-party 
parsers. While Cayenne would do all the DB-side heavy lifting. The two parts 
are cleanly separated.

Andrus


[1] https://cayenne.apache.org/docs/4.2/cayenne-guide/#value-object-type

Reply via email to