Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package it.unibas.forum.modello;
- import java.util.ArrayList;
- import java.util.List;
- import javax.persistence.*;
- @Entity
- public class Chat {
- private long id;
- private String nome;
- private String argomento;
- private List<Utente> listaUtenti = new ArrayList<Utente>();
- private List<Messaggio> listaMessaggi = new ArrayList<Messaggio>();
- public Chat() {
- }
- public Chat(String nome, String argomento) {
- this.nome = nome;
- this.argomento = argomento;
- }
- @Id
- @GeneratedValue(strategy = GenerationType.TABLE)
- public long getId() {
- return id;
- }
- public void setId(long id) {
- this.id = id;
- }
- @Column(unique = true)
- public String getNome() {
- return nome;
- }
- public void setNome(String nome) {
- this.nome = nome;
- }
- public String getArgomento() {
- return argomento;
- }
- public void setArgomento(String argomento) {
- this.argomento = argomento;
- }
- @OneToMany(mappedBy = "chat",cascade = CascadeType.ALL)
- public List<Utente> getListaUtenti() {
- return listaUtenti;
- }
- public void setListaUtenti(List<Utente> listaUtenti) {
- this.listaUtenti = listaUtenti;
- }
- @OneToMany(mappedBy = "chat",orphanRemoval = true,cascade = CascadeType.ALL)
- public List<Messaggio> getListaMessaggi() {
- return listaMessaggi;
- }
- public void setListaMessaggi(List<Messaggio> listaMessaggi) {
- this.listaMessaggi = listaMessaggi;
- }
- }
Add Comment
Please, Sign In to add comment