cartridge-springdata icon indicating copy to clipboard operation
cartridge-springdata copied to clipboard

Methods for custom mapping setup

Open bitgorbovsky opened this issue 3 years ago • 1 comments

There is no functionality for setting custom mappings on springdata level. It would be nice to have such possibility, for example, I want to map some flat structure (e.g tuple, and perhaps, nested tuples) with some classes (it's usually called unflattening).

bitgorbovsky avatar Sep 19 '22 14:09 bitgorbovsky

The built-in extension points for Spring Data converters (Java type to Java type) are available, look: https://github.com/tarantool/cartridge-springdata/blob/master/src/main/java/org/springframework/data/tarantool/config/AbstractTarantoolDataConfiguration.java#L211. Probably we are lacking a test for it and a link to the Spring Data doc about that in our README.

As for the MessagePack to Java type conversions, the users are supposed to use the TarantoolConfig: https://github.com/tarantool/cartridge-springdata/blob/master/src/main/java/org/springframework/data/tarantool/config/AbstractTarantoolDataConfiguration.java#L93 and https://github.com/tarantool/cartridge-java/blob/master/src/main/java/io/tarantool/driver/api/TarantoolClientConfig.java#L353 - they are supposed to provide a custom MessagePackMapper instance with their custom converters. Probably we need to update the driver version in the module and add the relevant section in the README.

Is that what you had in mind or something else?

akudiyar avatar Feb 15 '23 00:02 akudiyar