-
Notifications
You must be signed in to change notification settings - Fork 0
/
JPAUtilisateur.java
116 lines (97 loc) · 2.74 KB
/
JPAUtilisateur.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package net.wazari.dao.jpa.entity;
import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.*;
import net.wazari.dao.entity.Album;
import net.wazari.dao.entity.Utilisateur;
import org.hibernate.annotations.GenericGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author kevinpouget
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@Entity
@Table(name = "Utilisateur",
uniqueConstraints = {@UniqueConstraint(columnNames={"Nom"})}
)
public class JPAUtilisateur implements Utilisateur, Serializable {
private static final Logger log = LoggerFactory.getLogger(JPAUtilisateur.class.getName());
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy=GenerationType.IDENTITY, generator="IdOrGenerated")
@GenericGenerator(name="IdOrGenerated",
strategy="net.wazari.dao.jpa.entity.idGenerator.UseIdOrGenerate"
)
@Column(name = "ID", nullable = false)
private Integer id;
@Basic(optional = false)
@Column(name = "Nom", nullable = false, length = 100)
private String nom;
@OneToMany(mappedBy = "droit", fetch = FetchType.LAZY)
private List<JPAAlbum> jPAAlbumList;
public JPAUtilisateur() {
}
public JPAUtilisateur(Integer id) {
this.id = id;
}
public JPAUtilisateur(Integer id, String nom) {
this.id = id;
this.nom = nom;
}
@XmlAttribute
@Override
public Integer getId() {
return id;
}
@Override
public void setId(Integer id) {
this.id = id;
}
@XmlValue
@Override
public String getNom() {
return nom;
}
@Override
public void setNom(String nom) {
this.nom = nom;
}
@Override
public List<Album> getAlbumList() {
return (List) jPAAlbumList;
}
@Override
public void setAlbumList(List<Album> jPAAlbumList) {
this.jPAAlbumList = (List) jPAAlbumList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof JPAUtilisateur)) {
return false;
}
JPAUtilisateur other = (JPAUtilisateur) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.wazari.dao.jpa.entity.JPAUtilisateur[id=" + id +": "+getNom()+ "]";
}
}