2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
6 package com.edf.gde.entities;
8 import java.io.Serializable;
9 import java.util.Objects;
10 import javax.persistence.Basic;
11 import javax.persistence.Column;
12 import javax.persistence.Entity;
13 import javax.persistence.GeneratedValue;
14 import javax.persistence.GenerationType;
15 import javax.persistence.Id;
16 import javax.persistence.JoinColumn;
17 import javax.persistence.ManyToOne;
18 import javax.persistence.NamedQueries;
19 import javax.persistence.NamedQuery;
20 import javax.persistence.SequenceGenerator;
21 import javax.persistence.Table;
22 import javax.validation.constraints.NotNull;
23 import javax.validation.constraints.Size;
24 import javax.xml.bind.annotation.XmlRootElement;
31 @Table(name = "attribute")
34 @NamedQuery(name = "Attribute.findAll", query = "SELECT a FROM Attribute a"),
35 @NamedQuery(name = "Attribute.findById", query = "SELECT a FROM Attribute a WHERE a.id = :id"),
36 @NamedQuery(name = "Attribute.findByName", query = "SELECT a FROM Attribute a WHERE a.name = :name"),
37 @NamedQuery(name = "Attribute.findByType", query = "SELECT a FROM Attribute a WHERE a.type = :type"),
38 @NamedQuery(name = "Attribute.findByValue", query = "SELECT a FROM Attribute a WHERE a.value = :value"),
39 //@NamedQuery(name = "Attribute.findByMandatory", query = "SELECT a FROM Attribute a WHERE a.mandatory = :mandatory")
41 public class Attribute implements Serializable {
42 private static final long serialVersionUID = 1L;
44 @Basic(optional = false)
46 @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN_SEQUENCE")
47 @SequenceGenerator(name = "SEQ_GEN_SEQUENCE", allocationSize = 50)
51 @Column(name = "name")
54 @Column(name = "type")
57 @Column(name = "value")
59 @Column(name = "mandatory")
60 private Boolean mandatory;
61 @JoinColumn(name = "group_id", referencedColumnName = "id", nullable = false)
63 private AttributeGroup groupId;
68 public Attribute(long id) {
76 public void setId(long id) {
80 public String getName() {
84 public void setName(String name) {
88 public String getType() {
92 public void setType(String type) {
96 public String getValue() {
100 public void setValue(String value) {
104 public Boolean getMandatory() {
108 public void setMandatory(Boolean mandatory) {
109 this.mandatory = mandatory;
112 public AttributeGroup getGroupId() {
116 public void setGroupId(AttributeGroup groupId) {
117 this.groupId = groupId;
121 public String toString() {
122 return "com.edf.gde.entities.Attribute[ id=" + id + " ]";
126 public int hashCode() {
128 hash = 29 * hash + (int) (this.id ^ (this.id >>> 32));
129 hash = 29 * hash + Objects.hashCode(this.name);
130 hash = 29 * hash + Objects.hashCode(this.type);
131 hash = 29 * hash + Objects.hashCode(this.value);
132 hash = 29 * hash + Objects.hashCode(this.mandatory);
133 hash = 29 * hash + Objects.hashCode(this.groupId);
138 public boolean equals(Object obj) {
142 if (getClass() != obj.getClass()) {
145 final Attribute other = (Attribute) obj;
146 if (this.id != other.id) {