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

Custom Spring RedisHash with multiple IDs for a parametrized key

$
0
0

I have some Redis hash keys which are defined as Class:<class_id>:Student:<student_id>. I'm having trouble defining this parametrized RedisHash in Springboot for keys like this. So far I've only been defining hashes like these which have no issue.

@RedisHash(value = "Class")  // It becomes Redis key Class:1public class Class implements Serializable {    @Id    private Long classId;    private String className;    private String classLeaderName;}

For my required Redis hash, I want to define something like this:

@RedisHash(value = "Class:<class_id>:Student:<student_id>")  // It becomes Redis key Class:1:Student:21public class ClassStudent implements Serializable {    @Id    private Long classId;    @Id    private Long studentId;    private String studentName;    private String studentSurname;}

Any help would be greatly appreciated.


Viewing all articles
Browse latest Browse all 2204

Trending Articles