I have the below Sinister
entity
@Document@Getter@Setter@ToString@AllArgsConstructor@NoArgsConstructor@Builder(toBuilder = true)@JsonInclude(JsonInclude.Include.NON_EMPTY)public class Sinister { ....}public String on(FindSinister query) { final Map<Object, Object> hashEntries = redisTemplate.opsForHash().entries(Sinister.class.getSimpleName()); final List<Object> allValuesFromHash = new ArrayList<>(hashEntries.values()); if (CollectionUtils.isNotEmpty(allValuesFromHash)) { final JavaType targetType = objectMapper.getTypeFactory().constructCollectionType(List.class, Sinister.class); final List<Sinister> sinisters = objectMapper.readValue(objectMapper.writeValueAsString(allValuesFromHash), targetType); } ....}
I have the above method when i get the list of entities from redis, the fuction entries
return a Map<Object, Object>
, when i tried to convert it to List of Sinister i have the below error:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `Sinister` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('Sinister') at [Source: (StringReader); line: 1, column: 56495] (through reference chain: java.util.ArrayList[85])' and exception = 'null'java.lang.reflect.UndeclaredThrowableException