Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame^] | 1 | package com.example.myproject.entity; |
| 2 | |
| 3 | import javax.persistence.*; |
| 4 | import javax.validation.constraints.Max; |
| 5 | import javax.validation.constraints.Min; |
| 6 | |
| 7 | @Entity |
| 8 | @Table(name = "seed_rating", uniqueConstraints = @UniqueConstraint(columnNames = {"seed_id", "user_id"})) |
| 9 | public class SeedRating { |
| 10 | |
| 11 | @Id |
| 12 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 13 | @Column(name = "rating_id") |
| 14 | private Long ratingId; |
| 15 | |
| 16 | @Column(name = "seed_id", nullable = false) |
| 17 | private Long seedId; |
| 18 | |
| 19 | @Column(name = "user_id", nullable = false) |
| 20 | private Long userId; |
| 21 | |
| 22 | @Column(name = "score", nullable = false) |
| 23 | @Min(0) |
| 24 | @Max(10) |
| 25 | private Integer score; |
| 26 | |
| 27 | // Getters and Setters |
| 28 | public Long getRatingId() { |
| 29 | return ratingId; |
| 30 | } |
| 31 | |
| 32 | public void setRatingId(Long ratingId) { |
| 33 | this.ratingId = ratingId; |
| 34 | } |
| 35 | |
| 36 | public Long getSeedId() { |
| 37 | return seedId; |
| 38 | } |
| 39 | |
| 40 | public void setSeedId(Long seedId) { |
| 41 | this.seedId = seedId; |
| 42 | } |
| 43 | |
| 44 | public Long getUserId() { |
| 45 | return userId; |
| 46 | } |
| 47 | |
| 48 | public void setUserId(Long userId) { |
| 49 | this.userId = userId; |
| 50 | } |
| 51 | |
| 52 | public Integer getScore() { |
| 53 | return score; |
| 54 | } |
| 55 | |
| 56 | public void setScore(Integer score) { |
| 57 | this.score = score; |
| 58 | } |
| 59 | } |