argos/dmp-backend/web/src/main/java/eu/eudat/migration/entities/Theme.java

108 lines
2.1 KiB
Java

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<Guidance> 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<Guidance> getGuidances() {
return guidances;
}
public void setGuidances(Set<Guidance> guidances) {
this.guidances = guidances;
}
}