Tested with jedis 2.6.1 and 2.6.2.
redisTemplate.opsForHash().put("mykey", "myhashkey", 1);
127.0.0.1:6379> hkeys "mykey"
1) "\xac\xed\x00\x05t\x00\tmyhashkey"
127.0.0.1:6379> hget "mykey" "\xac\xed\x00\x05t\x00\tmyhashkey"
"\xac\xed\x00\x05sr\x00\x11java.lang.Integer\x12\xe2\xa0\xa4\xf7\x81\x878\x02\x00\x01I\x00\x05valuexr\x00\x10java.lang.Number\x86\xac\x95\x1d\x0b\x94\xe0\x8b\x02\x00\x00xp\x00\x00\x00\x01"
Then I'm trying to increment my value
redisTemplate.opsForHash().increment("mykey", "myhashkey", 1);
but I got the following problem:
org.springframework.dao.InvalidDataAccessApiUsageException: ERR hash value is not an integer; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR hash value is not an integer
When I'm doing
redisTemplate.opsForHash().increment("mykey", "myhashkey1", 1);
and field is not present in redis than it works perfect.
Any advice?