-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathBatch.java
More file actions
117 lines (96 loc) · 2.54 KB
/
Batch.java
File metadata and controls
117 lines (96 loc) · 2.54 KB
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
117
package com.revature.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name="ie_batch")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class Batch {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="batch_sequence")
@SequenceGenerator(allocationSize=1, name="batch_sequence", sequenceName="batch_seq")
@Column(name="b_id")
private Integer id;
@Column(name="b_name")
private String name;
@Column(name="b_is_active")
private boolean isActive;
@ManyToMany
@JoinTable(name="ie_person_batch", joinColumns=@JoinColumn(name="batch_id"), inverseJoinColumns=@JoinColumn(name="person_id"))
private Set<Person> persons;
public Batch() {}
public Batch(String name, boolean isActive) {
super();
this.name = name;
this.isActive = isActive;
}
public Set<Person> getPersons(){
return persons;
}
public void setPersons(Set<Person> people){
this.persons = people;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setisActive(boolean isActive){
this.isActive = isActive;
}
public boolean isActive(){
return isActive;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + (isActive ? 1231 : 1237);
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Batch other = (Batch) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (isActive != other.isActive)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
return "Batch [id=" + id + ", name=" + name + ", isActive=" + isActive + "]";
}
}