Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Set created and updated date in a Redis key-value pair with Spring Boot

$
0
0

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;}

Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>