package eu.eudat.migration.entities; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import javax.persistence.*; import java.util.Date; import java.util.HashSet; import java.util.Set; @Entity @Table(name = "themes") public class Theme { @Id private long id; private String title; private String description; @Column(name = "created_at") @Temporal(TemporalType.TIMESTAMP) private Date createdAt; @Column(name = "updated_at") @Temporal(TemporalType.TIMESTAMP) private Date updatedAt; private String locale; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "themes_in_guidance", joinColumns = {@JoinColumn(name = "theme_id")}, inverseJoinColumns = {@JoinColumn(name = "guidance_id")} ) @LazyCollection(LazyCollectionOption.FALSE) private Set guidances = new HashSet<>(); @Override public String toString() { return "Theme{" + "id=" + id + ", title='" + title + '\'' + ", description='" + description + '\'' + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt + ", locale='" + locale + '\'' + '}'; } 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 getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } public Date getUpdatedAt() { return updatedAt; } public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } public String getLocale() { return locale; } public void setLocale(String locale) { this.locale = locale; } public Set getGuidances() { return guidances; } public void setGuidances(Set guidances) { this.guidances = guidances; } }