fix: re-do in the event entity
still tentative
This commit is contained in:
parent
18680a0f90
commit
fee0309c4a
3 changed files with 5 additions and 14 deletions
|
@ -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<Person> participants;
|
||||
}
|
||||
|
|
|
@ -57,6 +57,10 @@ public class Expense {
|
|||
inverseJoinColumns = @JoinColumn(name = "people_id"))
|
||||
private Set<Person> debtors;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "EventId")
|
||||
private Event event;
|
||||
|
||||
@Column(name = "Date", nullable = false, columnDefinition = "DATE DEFAULT CURRENT_DATE")
|
||||
private LocalDate date;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,4 @@ public class Person {
|
|||
|
||||
@ManyToMany(mappedBy = "debtors")
|
||||
private Set<Expense> debtorExpenses;
|
||||
|
||||
@ManyToMany(mappedBy = "participants")
|
||||
private Set<Event> participants;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue