blob: af28e3c8234c983414c46698729cb57c28d7144f [file] [log] [blame]
rootff0769a2025-05-18 17:24:41 +00001package entity;
2
3import java.util.Date;
4import javax.persistence.*;
5
6@Entity
7@Table(name = "UserVotes")
8public class UserVotes {
9
10 @EmbeddedId
11 private UserVotesId id;
12
13 @ManyToOne(optional = false)
14 @JoinColumn(name = "user_id", referencedColumnName = "user_id",
15 foreignKey = @ForeignKey(name = "fk_user_votes_user"))
16 private User user;
17
18 @ManyToOne(optional = false)
19 @JoinColumn(name = "beg_id", referencedColumnName = "beg_id",
20 foreignKey = @ForeignKey(name = "fk_user_votes_beg"))
21 private BegInfo begInfo;
22
23 @ManyToOne(optional = false)
24 @JoinColumn(name = "seed_id", referencedColumnName = "seed_id",
25 foreignKey = @ForeignKey(name = "fk_user_votes_seed"))
26 private Seed seed;
27
28 @Column(name = "created_at", nullable = false)
29 @Temporal(TemporalType.TIMESTAMP)
30 private Date createdAt;
31
32 public UserVotes() {}
33
34 // getter and setter for the composite key and other fields
35 public UserVotesId getId() {
36 return id;
37 }
38
39 public void setId(UserVotesId id) {
40 this.id = id;
41 }
42
43 // getters and setters for user, begInfo, seed, createdAt
44}