From 8ffaf525eb96bb7cb98b38438f8c1c0eda878eb0 Mon Sep 17 00:00:00 2001 From: Marc Beyer Date: Sun, 28 Nov 2021 15:13:31 +0100 Subject: [PATCH] Changed date to PRIMARY KEY --- server/src/main/java/com/vpr/server/UserEvent.java | 2 ++ server/src/main/java/com/vpr/server/UserEventId.java | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/server/src/main/java/com/vpr/server/UserEvent.java b/server/src/main/java/com/vpr/server/UserEvent.java index d86c473..3cc2582 100644 --- a/server/src/main/java/com/vpr/server/UserEvent.java +++ b/server/src/main/java/com/vpr/server/UserEvent.java @@ -20,6 +20,8 @@ public class UserEvent { @JoinColumn(name = "event_id", referencedColumnName = "id") private Event event; + @Id + @Column(name="date", columnDefinition = "DATE DEFAULT CURRENT_DATE", nullable = false) private Date date; /********************* diff --git a/server/src/main/java/com/vpr/server/UserEventId.java b/server/src/main/java/com/vpr/server/UserEventId.java index 5e3d517..d8e1009 100644 --- a/server/src/main/java/com/vpr/server/UserEventId.java +++ b/server/src/main/java/com/vpr/server/UserEventId.java @@ -1,10 +1,12 @@ package com.vpr.server; import java.io.Serializable; +import java.sql.Date; public class UserEventId implements Serializable { private long user; private long event; + private Date date; /********************* * Getter and Setter * @@ -25,4 +27,12 @@ public class UserEventId implements Serializable { public void setEvent(long event) { this.event = event; } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } }