I am trying to set the creation timestamp and the updation timestamp in a Redis item just like we have in Hibernate and Spring Data JPA but it is just setting those fields to null.
@CreatedDateprivate Date createdAt;@LastModifiedDateprivate Date modifiedAt;
I am using the following dependencies:
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>redis.clients</groupId><artifactId>jedis</artifactId></dependency>
Below is the code that I am using:
@Builder@NoArgsConstructor@AllArgsConstructor@Getter@Setter@ToString@RedisHash(value = PersistenceConstants.HASH_CART)public class Cart implements Serializable { @Id private UUID id; @NotNull private long customerId; private List<Item> items; @CreatedDate private Date createdAt; @LastModifiedDate private Date modifiedAt;}