Open ArtDu opened 3 years ago
This bug must be fixed in the driver, I opened an issue https://github.com/tarantool/cartridge-java/issues/144.
Storing byte arrays in the fields of type string
requires a custom string-to-byte-array conversion on the client level using SpringData's custom converters mechanism (see https://github.com/tarantool/cartridge-springdata/blob/d8d1e2b9dfbe9839c50a85b397a8633c4b9f7677/src/main/java/org/springframework/data/tarantool/config/AbstractTarantoolDataConfiguration.java#L220). It is a valid w/a for this case, although creating String
s and then converting them into byte arrays may result in a huge memory overhead on the client.
Could be implrmrnted only for Tarantool 3.0
To reproduce the problem, I took an existing test by adding a byte [] field to the entity
Reproducer showed that data is written to tarantool normally, since messagePack
binary
is processed as a string in a tarantool. But we cannot get them back to java, since messagePackString
comes and we are trying to convert it tobyte []
The problem is that byte [] is collection, and the code asks us to return list https://github.com/tarantool/cartridge-springdata/blob/5e06e8f9ff6f5311c3ed7641fb71f40fb36937e5/src/main/java/org/springframework/data/tarantool/core/convert/MappingTarantoolReadConverter.java#L200-L201
The workaround was to use a custom mapper:
Also globally the problem may be related to this: https://github.com/tarantool/tarantool/issues/1629