-
-
Save vicentealencar/dd99690fcaaba2c834d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package modelo; | |
import java.io.Serializable; | |
import java.util.List; | |
import javax.persistence.Entity; | |
import javax.persistence.FetchType; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
import javax.persistence.Table; | |
import javax.persistence.Column; | |
import javax.persistence.JoinTable; | |
import javax.persistence.OneToMany; | |
import javax.persistence.JoinColumn; | |
@Entity | |
@Table(name="users") | |
public class User implements Serializable { | |
private static final long serialVersionUID = 2L; | |
private int id; | |
private String name; | |
private String email; | |
private String role; | |
private List<Client> notClients; | |
//@OneToMany | |
//@JoinTable(name = "not_organ_collections", | |
// joinColumns = @JoinColumn(name="user_id"), | |
// inverseJoinColumns=@JoinColumn(name="organ_id")) | |
//private List<Organ> notOrgans; | |
// | |
public void setEmail(String email) | |
{ | |
this.email = email; | |
} | |
@Id @GeneratedValue(strategy = GenerationType.AUTO) | |
public int getId() { | |
return id; | |
} | |
public void setId(int id) | |
{ | |
this.id = id; | |
} | |
@Column(name="name") | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public void setNotClients(List<Client> notClients) { | |
this.notClients = notClients; | |
} | |
@Column(name="email") | |
public String getEmail() | |
{ | |
return this.email; | |
} | |
@OneToMany(fetch=FetchType.EAGER) | |
@JoinTable(name = "not_client_collections", | |
joinColumns = @JoinColumn(name="user_id"), | |
inverseJoinColumns=@JoinColumn(name="client_id")) | |
public List<Client> getNotClients() | |
{ | |
return this.notClients; | |
} | |
@Column(name="role") | |
public String getRole() { | |
return role; | |
} | |
public void setRole(String role) { | |
this.role = role; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment