src/main/java/com/trawell/models/Wallet.java
package com.trawell.models;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
@Entity
/**
* @author Ruggiero Gaetano class models the user Wallet Document
*/
public class Wallet {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_owner")
private User user;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_group", nullable = false)
private TrawellGroup trawellGroup;
private boolean isPrivate;
@OneToMany(mappedBy = "wallet", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private List<Document> documents;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public List<Document> getDocuments() {
return documents;
}
public void setDocuments(List<Document> documents) {
this.documents = documents;
}
public boolean isPrivate() {
return isPrivate;
}
public void setPrivate(boolean isPrivate) {
this.isPrivate = isPrivate;
}
public TrawellGroup getGroup() {
return trawellGroup;
}
public void setGroup(TrawellGroup trawellGroup) {
this.trawellGroup = trawellGroup;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Wallet() {
}
}