99238cf0 |
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 java.util.Date; |
9 | import javax.persistence.*; |
ec18a5ac |
10 | import javax.servlet.http.HttpSession; |
99238cf0 |
11 | |
12 | /** |
13 | * |
14 | * @author maroni |
15 | */ |
16 | @Entity |
17 | @Table(name="SESSAO_USUARIO") |
18 | public class SessaoUsuario implements Serializable { |
19 | private static final long serialVersionUID = 1L; |
20 | @Id |
21 | @SequenceGenerator(name="seqSessaoUsuario", sequenceName="SQ_SESSAO_USUARIO") |
22 | @GeneratedValue(strategy = GenerationType.AUTO, generator="seqSessaoUsuario") |
23 | private Long id; |
24 | |
25 | @Temporal(TemporalType.TIMESTAMP) |
26 | @Column(nullable=false) |
27 | private Date data; |
28 | |
29 | @ManyToOne |
f42bcffd |
30 | @JoinColumn(nullable=false, name="caso_id") |
31 | private Caso caso; |
ec18a5ac |
32 | |
33 | @ManyToOne |
34 | @JoinColumn(nullable=false, name="usuario_id") |
35 | private Usuario usuario; |
36 | |
99238cf0 |
37 | public Date getData() { |
38 | return data; |
39 | } |
40 | |
41 | public void setData(Date data) { |
42 | this.data = data; |
43 | } |
44 | |
99238cf0 |
45 | public Long getId() { |
46 | return id; |
47 | } |
48 | |
49 | public void setId(Long id) { |
50 | this.id = id; |
51 | } |
52 | |
53 | @Override |
54 | public int hashCode() { |
55 | int hash = 0; |
56 | hash += (id != null ? id.hashCode() : 0); |
57 | return hash; |
58 | } |
59 | |
60 | @Override |
61 | public boolean equals(Object object) { |
99238cf0 |
62 | if (!(object instanceof SessaoUsuario)) { |
63 | return false; |
64 | } |
65 | SessaoUsuario other = (SessaoUsuario) object; |
66 | if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { |
67 | return false; |
68 | } |
69 | return true; |
70 | } |
99238cf0 |
71 | @Override |
72 | public String toString() { |
73 | return "org.ufcspa.simdecs.entities.SessaoUsuario[ id=" + id + " ]"; |
74 | } |
f42bcffd |
75 | |
76 | public Caso getCaso() { |
77 | return caso; |
78 | } |
79 | |
80 | public void setCaso(Caso caso) { |
81 | this.caso = caso; |
82 | } |
ec18a5ac |
83 | |
84 | |
85 | public Usuario getUsuario() { |
86 | return usuario; |
87 | } |
88 | |
89 | public void setUsuario(Usuario usuario) { |
90 | this.usuario = usuario; |
91 | } |
99238cf0 |
92 | } |