Description
Problems with the current state:
Currently, Spring Data Redis allows marshalling (serializing) POJOs using Redis Hashes with @RedisHash
annotation. This approach doesn’t allow efficiently store and querying nested objects like discussed here. Also, the selection of the proper serializer for POJOs is confusing for the developers.
Proposed solution:
Introduce a new API that allows extending Spring Data Redis with external/custom marshalling/unmarshaling implementations.
For example, it will allow us to build JSON-based serialization to store POJOs as JSON documents in Redis. JSON.GET allows to retrieve and update embedded data efficiently with JSONPath, which can be used to significantly improve the performance of retrieving nested objects.
An example of a JSON-based serialization can be found here https://github.com/redis/redis-om-spring/blob/main/demos/roms-documents/src/main/java/com/redis/om/documents/domain/Company.java#L27
This can be combined with #2546 to allow indexing JSON documents in addition to Hashes.