Commit | Line | Data |
---|---|---|
ae815b9b MS |
1 | /* |
2 | * To change this template, choose Tools | Templates | |
3 | * and open the template in the editor. | |
4 | */ | |
5 | package org.ufcspa.simdecs.entities; | |
6 | ||
7 | import java.io.Serializable; | |
8 | import javax.persistence.Entity; | |
9 | import javax.persistence.GeneratedValue; | |
10 | import javax.persistence.GenerationType; | |
11 | import javax.persistence.Id; | |
12 | import javax.persistence.JoinColumn; | |
13 | import javax.persistence.ManyToOne; | |
14 | import javax.persistence.SequenceGenerator; | |
15 | ||
16 | /** | |
17 | * | |
18 | * @author maroni | |
19 | */ | |
20 | @Entity | |
21 | public class NodoPaciente implements Serializable { | |
22 | private static final long serialVersionUID = 1L; | |
23 | @Id | |
24 | @SequenceGenerator(name="SeqNodoPaciente", sequenceName="SQ_NODO_PACIENTE") | |
25 | @GeneratedValue(strategy = GenerationType.AUTO, generator="SeqNodoPaciente") | |
26 | private Long id; | |
27 | ||
28 | @ManyToOne | |
29 | @JoinColumn(name="nodo_id", nullable=false) | |
30 | private Nodo nodo; | |
31 | ||
32 | @ManyToOne | |
33 | @JoinColumn(name="paciente_id", nullable=false) | |
34 | private Paciente paciente; | |
35 | ||
36 | public Long getId() { | |
37 | return id; | |
38 | } | |
39 | ||
40 | public void setId(Long id) { | |
41 | this.id = id; | |
42 | } | |
43 | ||
44 | @Override | |
45 | public int hashCode() { | |
46 | int hash = 0; | |
47 | hash += (id != null ? id.hashCode() : 0); | |
48 | return hash; | |
49 | } | |
50 | ||
51 | @Override | |
52 | public boolean equals(Object object) { | |
ae815b9b MS |
53 | if (!(object instanceof NodoPaciente)) { |
54 | return false; | |
55 | } | |
56 | NodoPaciente other = (NodoPaciente) object; | |
57 | if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { | |
58 | return false; | |
59 | } | |
60 | return true; | |
61 | } | |
62 | ||
63 | @Override | |
64 | public String toString() { | |
65 | return "org.ufcspa.simdecs.entities.NodoPaciente[ id=" + id + " ]"; | |
66 | } | |
67 | ||
68 | public Nodo getNodo() { | |
69 | return nodo; | |
70 | } | |
71 | ||
72 | public void setNodo(Nodo nodo) { | |
73 | this.nodo = nodo; | |
74 | } | |
75 | ||
76 | public Paciente getPaciente() { | |
77 | return paciente; | |
78 | } | |
79 | ||
80 | public void setPaciente(Paciente paciente) { | |
81 | this.paciente = paciente; | |
82 | } | |
83 | ||
84 | } |