https://github.com/binakot/spring-data-redis-null-elements
The sample project to show a problem of storing collections with `null` elements in Spring Redis Data.
https://github.com/binakot/spring-data-redis-null-elements
collection null problem redis spring spring-data spring-data-redis spring-data-redis-example
Last synced: 11 months ago
JSON representation
The sample project to show a problem of storing collections with `null` elements in Spring Redis Data.
- Host: GitHub
- URL: https://github.com/binakot/spring-data-redis-null-elements
- Owner: binakot
- License: mit
- Created: 2019-12-09T11:00:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T12:01:44.000Z (about 6 years ago)
- Last Synced: 2025-01-16T12:55:08.404Z (about 1 year ago)
- Topics: collection, null, problem, redis, spring, spring-data, spring-data-redis, spring-data-redis-example
- Language: Java
- Homepage: https://github.com/spring-projects/spring-data-redis/issues/1648
- Size: 11.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Spring Data Redis
The sample project to show a problem of storing collections with `null` elements in Spring Redis Data.
When we save the java nullable object as `null`, Redis just skips it, because it hasn't an equivalent for `NULL`.
On saving collections with some nulls, method will be break on the first null element in a collection.
It's okay for NULL-ending collections, but we're missing elements with NULL-leading or NULL in a middle collections.
Line of the code that break write elements on the first null:
https://github.com/spring-projects/spring-data-redis/blob/master/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java#L705
Commit that adding this feature:
https://github.com/spring-projects/spring-data-redis/commit/2492fbe332b7565e0724b8f7ec6c62f5d3178b25#diff-b71f4f4366952781ed005f6224ff7d5dR511
Project is based on:
https://github.com/eugenp/tutorials/tree/master/persistence-modules/spring-data-redis
### Relevant Articles:
- [Introduction to Spring Data Redis](http://www.baeldung.com/spring-data-redis-tutorial)
- [PubSub Messaging with Spring Data Redis](http://www.baeldung.com/spring-data-redis-pub-sub)
- [An Introduction to Spring Data Redis Reactive](https://www.baeldung.com/spring-data-redis-reactive)
### Build the Project with Tests Running
```
mvn clean install
```
### Run Tests Directly
```
mvn test
```