package ba.steleks.model; import com.sun.istack.internal.Nullable; import javax.persistence.*; import java.sql.Timestamp; import java.util.Set; /** * Created by admin on 22/03/2017. */ @Entity public class Event { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; private String title; @Column(columnDefinition="text") private String shortText; @Column(columnDefinition="text") private String longText; private Timestamp dateTime; private int duration; @Nullable private long createdById; @ManyToOne @JoinColumn private EventType eventType; @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable( name = "event_media_set", joinColumns=@JoinColumn(name = "event_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name="media_set_id", referencedColumnName = "id") ) private Set mediaSet; public Event() {} public long getId() { return id; } public void setId(long id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getShortText() { return shortText; } public void setShortText(String shortText) { this.shortText = shortText; } public String getLongText() { return longText; } public void setLongText(String longText) { this.longText = longText; } public Timestamp getDateTime() { return dateTime; } public void setDateTime(Timestamp dateTime) { this.dateTime = dateTime; } public int getDuration() { return duration; } public void setDuration(int duration) { this.duration = duration; } public long getCreatedById() { return createdById; } public void setCreatedById(long createdById) { this.createdById = createdById; } public EventType getEventType() { return eventType; } public void setEventType(EventType eventType) { this.eventType = eventType; } public Set getMediaSet() { return mediaSet; } public void setMediaSet(Set mediaSet) { this.mediaSet = mediaSet; } }