From be2dd291f69111144da7a1a32ffcc6f4db1e60ec Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Thu, 4 Apr 2019 12:48:05 +0400 Subject: [PATCH] #55 added conference model without user's participation and deposit. May be needed new user model. --- .../ru/ulstu/conference/model/Conference.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/main/java/ru/ulstu/conference/model/Conference.java b/src/main/java/ru/ulstu/conference/model/Conference.java index b2851ed..12e1869 100644 --- a/src/main/java/ru/ulstu/conference/model/Conference.java +++ b/src/main/java/ru/ulstu/conference/model/Conference.java @@ -1,11 +1,60 @@ package ru.ulstu.conference.model; +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; +import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; +import ru.ulstu.deadline.model.Deadline; +import ru.ulstu.paper.model.Paper; +import ru.ulstu.user.model.User; +import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToMany; +import javax.persistence.OneToMany; +import javax.persistence.OrderBy; import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; @Entity @Table(name = "conference") public class Conference extends BaseEntity { + + @NotBlank + private String title; + + private String description; + + private String url; + + private int ping; + + @Column(name = "begin_date") + @Temporal(TemporalType.TIMESTAMP) + private Date beginDate = new Date(); + + @Column(name = "end_date") + @Temporal(TemporalType.TIMESTAMP) + private Date endDate = new Date(); + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @JoinColumn(name = "conference_id", unique = true) + @Fetch(FetchMode.SUBSELECT) + @OrderBy("date") + private List deadlines = new ArrayList<>(); + + @ManyToMany(fetch = FetchType.EAGER) + private Set papers = new HashSet<>(); + + @ManyToMany(fetch = FetchType.EAGER) + private Set users = new HashSet<>(); }