diff --git a/src/main/java/com/application/munera/data/Event.java b/src/main/java/com/application/munera/data/Event.java index e6bfc23..d0ea1b7 100644 --- a/src/main/java/com/application/munera/data/Event.java +++ b/src/main/java/com/application/munera/data/Event.java @@ -5,17 +5,14 @@ import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; -import java.util.Set; - @Entity -@Setter @Getter +@Setter @Table(name = "events") public class Event { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "Id", unique = true, nullable = false) private Long id; @Size(max = 100) @@ -25,11 +22,4 @@ public class Event { @Size(max = 100) @Column(name = "Description") private String description; - - @ManyToMany(fetch = FetchType.EAGER) - @JoinTable( - name = "Event_participants", - joinColumns = @JoinColumn(name = "event_id"), - inverseJoinColumns = @JoinColumn(name = "participant_id")) - private Set participants; } diff --git a/src/main/java/com/application/munera/data/Expense.java b/src/main/java/com/application/munera/data/Expense.java index 0b9bcfb..807dedb 100644 --- a/src/main/java/com/application/munera/data/Expense.java +++ b/src/main/java/com/application/munera/data/Expense.java @@ -57,6 +57,10 @@ public class Expense { inverseJoinColumns = @JoinColumn(name = "people_id")) private Set debtors; + @ManyToOne + @JoinColumn(name = "EventId") + private Event event; + @Column(name = "Date", nullable = false, columnDefinition = "DATE DEFAULT CURRENT_DATE") private LocalDate date; } diff --git a/src/main/java/com/application/munera/data/Person.java b/src/main/java/com/application/munera/data/Person.java index cf70fd5..2ffae57 100644 --- a/src/main/java/com/application/munera/data/Person.java +++ b/src/main/java/com/application/munera/data/Person.java @@ -44,7 +44,4 @@ public class Person { @ManyToMany(mappedBy = "debtors") private Set debtorExpenses; - - @ManyToMany(mappedBy = "participants") - private Set participants; }