├── .gitignore
├── .springBeans
├── pom.xml
└── src
└── main
├── java
└── com
│ └── ramazan
│ └── bean
│ ├── employee
│ ├── Department.java
│ ├── Employee.java
│ ├── Job.java
│ └── Location.java
│ └── user
│ ├── PasswordResetToken.java
│ ├── Privilege.java
│ ├── Role.java
│ ├── User.java
│ └── VerificationToken.java
└── resources
├── META-INF
└── persistance.xml
└── database
└── database.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | *.project
2 | *.classpath
3 | *.class
4 | *.prefs
5 | /target/
6 |
--------------------------------------------------------------------------------
/.springBeans:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | com.ramazan.model
5 | UHT
6 | 1.0
7 |
8 |
9 |
10 |
11 | org.apache.maven.plugins
12 | maven-compiler-plugin
13 | 3.1
14 |
15 | 1.8
16 | 1.8
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | org.hibernate
27 | hibernate-core
28 | 5.1.0.Final
29 |
30 |
31 |
32 | org.hibernate
33 | hibernate-entitymanager
34 | 5.1.0.Final
35 |
36 |
37 |
38 | org.hibernate
39 | hibernate-c3p0
40 | 5.1.0.Final
41 |
42 |
43 |
44 |
45 |
46 | org.springframework
47 | spring-context
48 | 4.3.3.RELEASE
49 |
50 |
51 |
52 | org.springframework
53 | spring-expression
54 | 4.3.3.RELEASE
55 |
56 |
57 |
58 | org.springframework
59 | spring-context
60 | 4.3.3.RELEASE
61 |
62 |
63 |
64 | org.springframework
65 | spring-orm
66 | 4.3.3.RELEASE
67 |
68 |
69 |
70 | org.springframework
71 | spring-context-support
72 | 4.3.3.RELEASE
73 |
74 |
75 |
76 | org.springframework
77 | spring-tx
78 | 4.3.3.RELEASE
79 |
80 |
81 |
82 | org.springframework
83 | spring-aop
84 | 4.3.3.RELEASE
85 |
86 |
87 |
88 | org.apache.commons
89 | commons-dbcp2
90 | 2.1.1
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/employee/Department.java:
--------------------------------------------------------------------------------
1 | package com.ramazan.bean.employee;
2 |
3 | import java.util.List;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.FetchType;
8 | import javax.persistence.ForeignKey;
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.CascadeType;
15 | import javax.persistence.OneToMany;
16 |
17 | @Entity
18 | public class Department {
19 |
20 | @Id
21 | @GeneratedValue(strategy = GenerationType.AUTO)
22 | @Column(name = "department_id")
23 | private Long departmentId;
24 |
25 | @Column
26 | private String departmentName;
27 |
28 | @ManyToOne(targetEntity = Location.class, fetch = FetchType.LAZY)
29 | @JoinColumn(name = "location_id", foreignKey = @ForeignKey(foreignKeyDefinition = "location_fk"))
30 | private Location location;
31 |
32 | // FetchType
33 | // veritabanimizida hibernate kullanarak department tablosuna select
34 | // attigimizda o tabloya bagli tablolarinda gelip gelmeyecegini
35 | // FetchType kullanarak belirtiyoruz , eger LAZY yaparsak herbir departman
36 | // varligi icin location bilgisini alamayiz
37 | // EAGER yaparsak locationida alabiliriz.
38 |
39 | // FetchType kullanmazsak hibernate sorgu sirasinda bir session aciyor
40 |
41 | @OneToMany(cascade = CascadeType.ALL, mappedBy = "department")
42 | private List employees;
43 |
44 | public Department() {
45 | }
46 |
47 | public Department(String departmentName, Location location,
48 | List employees) {
49 | this.departmentName = departmentName;
50 | this.location = location;
51 | this.employees = employees;
52 | }
53 |
54 | public Long getDepartmentId() {
55 | return departmentId;
56 | }
57 |
58 | public void setDepartmentId(Long departmentId) {
59 | this.departmentId = departmentId;
60 | }
61 |
62 | public String getDepartmentName() {
63 | return departmentName;
64 | }
65 |
66 | public void setDepartmentName(String departmentName) {
67 | this.departmentName = departmentName;
68 | }
69 |
70 | public Location getLocation() {
71 | return location;
72 | }
73 |
74 | public void setLocation(Location location) {
75 | this.location = location;
76 | }
77 |
78 | public List getEmployees() {
79 | return employees;
80 | }
81 |
82 | public void setEmployees(List employees) {
83 | this.employees = employees;
84 | }
85 |
86 | @Override
87 | public int hashCode() {
88 | final int prime = 31;
89 | int result = 1;
90 | result = prime * result
91 | + ((departmentId == null) ? 0 : departmentId.hashCode());
92 | return result;
93 | }
94 |
95 | @Override
96 | public boolean equals(Object obj) {
97 | if (this == obj)
98 | return true;
99 | if (obj == null)
100 | return false;
101 | if (getClass() != obj.getClass())
102 | return false;
103 | Department other = (Department) obj;
104 | if (departmentId == null) {
105 | if (other.departmentId != null)
106 | return false;
107 | } else if (!departmentId.equals(other.departmentId))
108 | return false;
109 | return true;
110 | }
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/employee/Employee.java:
--------------------------------------------------------------------------------
1 | package com.ramazan.bean.employee;
2 |
3 | import java.util.Date;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.FetchType;
8 | import javax.persistence.ForeignKey;
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.NamedQueries;
15 | import javax.persistence.NamedQuery;
16 | import javax.persistence.Temporal;
17 | import javax.persistence.TemporalType;
18 |
19 | @NamedQueries({
20 | @NamedQuery(name = "Employee.findAll", query = "SELECT e FROM Employee e"),
21 | @NamedQuery(name = "Employee.findFullById", query = "SELECT e FROM Employee e LEFT OUTER JOIN FETCH e.department WHERE e.employeeId = :employeeId"),
22 | @NamedQuery(name = "Employee.count", query = "SELECT Count(*) FROM Employee")
23 | })
24 |
25 | @Entity
26 |
27 | public class Employee {
28 |
29 | @Id
30 | @GeneratedValue(strategy = GenerationType.AUTO)
31 | private Long employeeId;
32 |
33 | @Column
34 | private String firstName;
35 |
36 | @Column
37 | private String lastName;
38 |
39 | @Column
40 | private String email;
41 |
42 | @Column
43 | private String phoneNumber;
44 |
45 | @Temporal(TemporalType.DATE)
46 | @Column
47 | private Date hireDate;
48 |
49 | // @Temporal , date tutmak icin ozel annotation kullandik
50 |
51 | @ManyToOne(fetch = FetchType.LAZY, targetEntity = Job.class)
52 | @JoinColumn(name = "job_id", foreignKey = @ForeignKey(foreignKeyDefinition = "job_fk"))
53 | private Job job;
54 |
55 | @ManyToOne(fetch = FetchType.LAZY, targetEntity = Department.class)
56 | @JoinColumn(name = "department_id", foreignKey = @ForeignKey(foreignKeyDefinition = "department_fk"))
57 | private Department department;
58 |
59 | public Employee() {
60 | }
61 |
62 | public Employee(String firstName, String lastName, String email,
63 | String phoneNumber, Date hireDate, Job job, Department department) {
64 | this.firstName = firstName;
65 | this.lastName = lastName;
66 | this.email = email;
67 | this.phoneNumber = phoneNumber;
68 | this.hireDate = hireDate;
69 | this.job = job;
70 | this.department = department;
71 | }
72 |
73 | public Long getEmployeeId() {
74 | return employeeId;
75 | }
76 |
77 | public void setEmployeeId(Long employeeId) {
78 | this.employeeId = employeeId;
79 | }
80 |
81 | public String getFirstName() {
82 | return firstName;
83 | }
84 |
85 | public void setFirstName(String firstName) {
86 | this.firstName = firstName;
87 | }
88 |
89 | public String getLastName() {
90 | return lastName;
91 | }
92 |
93 | public void setLastName(String lastName) {
94 | this.lastName = lastName;
95 | }
96 |
97 | public String getEmail() {
98 | return email;
99 | }
100 |
101 | public void setEmail(String email) {
102 | this.email = email;
103 | }
104 |
105 | public String getPhoneNumber() {
106 | return phoneNumber;
107 | }
108 |
109 | public void setPhoneNumber(String phoneNumber) {
110 | this.phoneNumber = phoneNumber;
111 | }
112 |
113 | public Date getHireDate() {
114 | return hireDate;
115 | }
116 |
117 | public void setHireDate(Date hireDate) {
118 | this.hireDate = hireDate;
119 | }
120 |
121 | public Job getJob() {
122 | return job;
123 | }
124 |
125 | public void setJob(Job job) {
126 | this.job = job;
127 | }
128 |
129 | public Department getDepartment() {
130 | return department;
131 | }
132 |
133 | public void setDepartment(Department department) {
134 | this.department = department;
135 | }
136 |
137 | @Override
138 | public int hashCode() {
139 | final int prime = 31;
140 | int result = 1;
141 | result = prime * result
142 | + ((employeeId == null) ? 0 : employeeId.hashCode());
143 | return result;
144 | }
145 |
146 | @Override
147 | public boolean equals(Object obj) {
148 | if (this == obj)
149 | return true;
150 | if (obj == null)
151 | return false;
152 | if (getClass() != obj.getClass())
153 | return false;
154 | Employee other = (Employee) obj;
155 | if (employeeId == null) {
156 | if (other.employeeId != null)
157 | return false;
158 | } else if (!employeeId.equals(other.employeeId))
159 | return false;
160 | return true;
161 | }
162 |
163 | }
164 |
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/employee/Job.java:
--------------------------------------------------------------------------------
1 | package com.ramazan.bean.employee;
2 |
3 | import java.util.List;
4 |
5 | import javax.persistence.CascadeType;
6 | import javax.persistence.Column;
7 | import javax.persistence.Entity;
8 | import javax.persistence.GeneratedValue;
9 | import javax.persistence.GenerationType;
10 | import javax.persistence.Id;
11 | import javax.persistence.NamedQueries;
12 | import javax.persistence.NamedQuery;
13 | import javax.persistence.OneToMany;
14 |
15 | @NamedQueries({
16 | @NamedQuery(name = "Job.findAll", query = "SELECT j FROM Job j "),
17 | @NamedQuery(name = "Job.findAllByJobTitle", query = "SELECT j FROM Job j WHERE j.jobTitle = :jobTitle"),
18 | @NamedQuery(name = "Job.findEmployeesById", query = "SELECT j FROM Job j LEFT OUTER JOIN FETCH j.employees WHERE j.jobId = : jobId")
19 | // Eger yukaridaki yazdigim sorgulardan herhangi birinde bir hata var ise
20 | // compile zamaninda compile error alirim!
21 | })
22 |
23 | @Entity
24 | public class Job {
25 | @Id
26 | @GeneratedValue(strategy = GenerationType.AUTO)
27 | private Long jobId;
28 |
29 | @Column
30 | private String jobTitle;
31 |
32 | @Column
33 | private double minSalary;
34 |
35 | @Column
36 | private double maxSalary;
37 |
38 | @OneToMany(cascade = CascadeType.ALL, mappedBy = "job")
39 | private List employees;
40 |
41 | public Job() {
42 | }
43 |
44 | public Job(String jobTitle, double minSalary, double maxSalary,
45 | List employees) {
46 | this.jobTitle = jobTitle;
47 | this.minSalary = minSalary;
48 | this.maxSalary = maxSalary;
49 | this.employees = employees;
50 | }
51 |
52 | public Long getJobId() {
53 | return jobId;
54 | }
55 |
56 | public void setJobId(Long jobId) {
57 | this.jobId = jobId;
58 | }
59 |
60 | public String getJobTitle() {
61 | return jobTitle;
62 | }
63 |
64 | public void setJobTitle(String jobTitle) {
65 | this.jobTitle = jobTitle;
66 | }
67 |
68 | public double getMinSalary() {
69 | return minSalary;
70 | }
71 |
72 | public void setMinSalary(double minSalary) {
73 | this.minSalary = minSalary;
74 | }
75 |
76 | public double getMaxSalary() {
77 | return maxSalary;
78 | }
79 |
80 | public void setMaxSalary(double maxSalary) {
81 | this.maxSalary = maxSalary;
82 | }
83 |
84 | public List getEmployees() {
85 | return employees;
86 | }
87 |
88 | public void setEmployees(List employees) {
89 | this.employees = employees;
90 | }
91 |
92 | @Override
93 | public int hashCode() {
94 | final int prime = 31;
95 | int result = 1;
96 | result = prime * result + ((jobId == null) ? 0 : jobId.hashCode());
97 | return result;
98 | }
99 |
100 | @Override
101 | public boolean equals(Object obj) {
102 | if (this == obj)
103 | return true;
104 | if (obj == null)
105 | return false;
106 | if (getClass() != obj.getClass())
107 | return false;
108 | Job other = (Job) obj;
109 | if (jobId == null) {
110 | if (other.jobId != null)
111 | return false;
112 | } else if (!jobId.equals(other.jobId))
113 | return false;
114 | return true;
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/employee/Location.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramazan/Spring-MVC-Hibernate/7f4103d7f0a265e9dd74fccd5cfb9bd8fd8fc5bf/src/main/java/com/ramazan/bean/employee/Location.java
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/user/PasswordResetToken.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramazan/Spring-MVC-Hibernate/7f4103d7f0a265e9dd74fccd5cfb9bd8fd8fc5bf/src/main/java/com/ramazan/bean/user/PasswordResetToken.java
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/user/Privilege.java:
--------------------------------------------------------------------------------
1 | package com.ramazan.bean.user;
2 |
3 | import java.util.List;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 | import javax.persistence.ManyToMany;
11 |
12 |
13 | @Entity
14 | public class Privilege {
15 |
16 | @Id
17 | @GeneratedValue(strategy = GenerationType.AUTO)
18 | @Column(name = "privilege_id")
19 | private Long id;
20 |
21 | @Column
22 | private String name;
23 |
24 | @ManyToMany(mappedBy = "priveleges")
25 | private List roles;
26 |
27 | public Privilege() {
28 | }
29 |
30 | public Privilege(String name, List roles) {
31 | super();
32 | this.name = name;
33 | this.roles = roles;
34 | }
35 |
36 | public Long getId() {
37 | return id;
38 | }
39 |
40 | public void setId(Long id) {
41 | this.id = id;
42 | }
43 |
44 | public String getName() {
45 | return name;
46 | }
47 |
48 | public void setName(String name) {
49 | this.name = name;
50 | }
51 |
52 | public List getRoles() {
53 | return roles;
54 | }
55 |
56 | public void setRoles(List roles) {
57 | this.roles = roles;
58 | }
59 |
60 | @Override
61 | public int hashCode() {
62 | final int prime = 31;
63 | int result = 1;
64 | result = prime * result + ((id == null) ? 0 : id.hashCode());
65 | return result;
66 | }
67 |
68 | @Override
69 | public boolean equals(Object obj) {
70 | if (this == obj)
71 | return true;
72 | if (obj == null)
73 | return false;
74 | if (getClass() != obj.getClass())
75 | return false;
76 | Privilege other = (Privilege) obj;
77 | if (id == null) {
78 | if (other.id != null)
79 | return false;
80 | } else if (!id.equals(other.id))
81 | return false;
82 | return true;
83 | }
84 |
85 |
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/user/Role.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ramazan/Spring-MVC-Hibernate/7f4103d7f0a265e9dd74fccd5cfb9bd8fd8fc5bf/src/main/java/com/ramazan/bean/user/Role.java
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/user/User.java:
--------------------------------------------------------------------------------
1 | package com.ramazan.bean.user;
2 |
3 | import javax.persistence.Column;
4 | import javax.persistence.Entity;
5 | import javax.persistence.FetchType;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.GenerationType;
8 | import javax.persistence.Id;
9 | import javax.persistence.JoinColumn;
10 | import javax.persistence.ManyToOne;
11 |
12 |
13 | @Entity
14 | public class User {
15 |
16 |
17 | @Id
18 | @GeneratedValue(strategy= GenerationType.AUTO)
19 | @Column(name = "user_id")
20 | private Long id;
21 |
22 | @Column
23 | private String firstName;
24 |
25 | @Column
26 | private String lastName;
27 |
28 | @Column(unique = true , nullable = false)
29 | private String username;;
30 |
31 | @Column
32 | private String email;
33 |
34 | @Column(length = 60)
35 | private String password;
36 |
37 |
38 | private boolean enabled;
39 |
40 | private boolean accountNonExpired;
41 |
42 | private boolean credentialsNonExpired;
43 |
44 | private boolean accounNonLocked;
45 |
46 | @ManyToOne(fetch = FetchType.LAZY)
47 | @JoinColumn(name = "role_id" )
48 | private Role role;
49 |
50 | public User() {
51 | this.enabled = false;
52 | this.accountNonExpired = true;
53 | this.credentialsNonExpired = true;
54 | this.accounNonLocked = true;
55 | }
56 |
57 | public User(String firstName, String lastName, String username,
58 | String email, String password, Role role) {
59 | this.firstName = firstName;
60 | this.lastName = lastName;
61 | this.username = username;
62 | this.email = email;
63 | this.password = password;
64 | this.role = role;
65 | this.enabled = false;
66 | this.accountNonExpired = true;
67 | this.credentialsNonExpired = true;
68 | this.accounNonLocked = true;
69 | }
70 |
71 | public Long getId() {
72 | return id;
73 | }
74 |
75 | public void setId(Long id) {
76 | this.id = id;
77 | }
78 |
79 | public String getFirstName() {
80 | return firstName;
81 | }
82 |
83 | public void setFirstName(String firstName) {
84 | this.firstName = firstName;
85 | }
86 |
87 | public String getLastName() {
88 | return lastName;
89 | }
90 |
91 | public void setLastName(String lastName) {
92 | this.lastName = lastName;
93 | }
94 |
95 | public String getUsername() {
96 | return username;
97 | }
98 |
99 | public void setUsername(String username) {
100 | this.username = username;
101 | }
102 |
103 | public String getEmail() {
104 | return email;
105 | }
106 |
107 | public void setEmail(String email) {
108 | this.email = email;
109 | }
110 |
111 | public String getPassword() {
112 | return password;
113 | }
114 |
115 | public void setPassword(String password) {
116 | this.password = password;
117 | }
118 |
119 | public boolean isEnabled() {
120 | return enabled;
121 | }
122 |
123 | public void setEnabled(boolean enabled) {
124 | this.enabled = enabled;
125 | }
126 |
127 | public boolean isAccountNonExpired() {
128 | return accountNonExpired;
129 | }
130 |
131 | public void setAccountNonExpired(boolean accountNonExpired) {
132 | this.accountNonExpired = accountNonExpired;
133 | }
134 |
135 | public boolean isCredentialsNonExpired() {
136 | return credentialsNonExpired;
137 | }
138 |
139 | public void setCredentialsNonExpired(boolean credentialsNonExpired) {
140 | this.credentialsNonExpired = credentialsNonExpired;
141 | }
142 |
143 | public boolean isAccounNonLocked() {
144 | return accounNonLocked;
145 | }
146 |
147 | public void setAccounNonLocked(boolean accounNonLocked) {
148 | this.accounNonLocked = accounNonLocked;
149 | }
150 |
151 | public Role getRole() {
152 | return role;
153 | }
154 |
155 | public void setRole(Role role) {
156 | this.role = role;
157 | }
158 |
159 | @Override
160 | public int hashCode() {
161 | final int prime = 31;
162 | int result = 1;
163 | result = prime * result + ((id == null) ? 0 : id.hashCode());
164 | result = prime * result
165 | + ((username == null) ? 0 : username.hashCode());
166 | return result;
167 | }
168 |
169 | @Override
170 | public boolean equals(Object obj) {
171 | if (this == obj)
172 | return true;
173 | if (obj == null)
174 | return false;
175 | if (getClass() != obj.getClass())
176 | return false;
177 | User other = (User) obj;
178 | if (id == null) {
179 | if (other.id != null)
180 | return false;
181 | } else if (!id.equals(other.id))
182 | return false;
183 | if (username == null) {
184 | if (other.username != null)
185 | return false;
186 | } else if (!username.equals(other.username))
187 | return false;
188 | return true;
189 | }
190 |
191 |
192 |
193 |
194 |
195 | }
196 |
--------------------------------------------------------------------------------
/src/main/java/com/ramazan/bean/user/VerificationToken.java:
--------------------------------------------------------------------------------
1 | package com.ramazan.bean.user;
2 |
3 | import java.util.Calendar;
4 | import java.util.Date;
5 | import java.util.List;
6 |
7 | import javax.persistence.Column;
8 | import javax.persistence.Entity;
9 | import javax.persistence.FetchType;
10 | import javax.persistence.GeneratedValue;
11 | import javax.persistence.GenerationType;
12 | import javax.persistence.Id;
13 | import javax.persistence.JoinColumn;
14 | import javax.persistence.OneToOne;
15 | import javax.persistence.Table;
16 | import javax.persistence.Temporal;
17 | import javax.persistence.TemporalType;
18 | import javax.persistence.Transient;
19 |
20 | @Entity
21 | @Table(name = "VerificationToken")
22 | public class VerificationToken {
23 |
24 | @Transient
25 | //tokenin sona erme suresi
26 | private final int EXPIRY_DATE = 60*24; // 60dk * 24 saat
27 |
28 | @Id
29 | @GeneratedValue(strategy = GenerationType.AUTO)
30 | private Long id;
31 |
32 | @OneToOne(fetch = FetchType.EAGER)
33 | @JoinColumn(name = "user_id")
34 |
35 | private User user;
36 |
37 |
38 | @Column
39 | private String token;
40 |
41 | @Temporal(TemporalType.TIMESTAMP)
42 | private Date expiryDate;
43 |
44 | public VerificationToken() {
45 |
46 | this.expiryDate = calculateExpiryDate(EXPIRY_DATE);
47 | }
48 |
49 | public VerificationToken(User user, String token) {
50 | this.user = user;
51 | this.token = token;
52 | this.expiryDate = calculateExpiryDate(EXPIRY_DATE);
53 | }
54 |
55 | private Date calculateExpiryDate(int EXPIRY_DATE) {
56 |
57 | Calendar calendar = Calendar.getInstance(); // takvim olustur
58 |
59 | calendar.setTimeInMillis(new Date().getTime()); // su anki
60 |
61 | calendar.add(Calendar.MINUTE, EXPIRY_DATE); // Takvime dakika turunden data eklenmesi
62 |
63 | return new Date(calendar.getTime().getTime());
64 | }
65 |
66 | public Long getId() {
67 | return id;
68 | }
69 |
70 | public void setId(Long id) {
71 | this.id = id;
72 | }
73 |
74 | public User getUser() {
75 | return user;
76 | }
77 |
78 | public void setUser(User user) {
79 | this.user = user;
80 | }
81 |
82 | public String getToken() {
83 | return token;
84 | }
85 |
86 | public void setToken(String token) {
87 | this.token = token;
88 | }
89 |
90 | public Date getExpiryDate() {
91 | return expiryDate;
92 | }
93 |
94 | public void setExpiryDate(Date expiryDate) {
95 | this.expiryDate = expiryDate;
96 | }
97 |
98 | public int getEXPIRY_DATE() {
99 | return EXPIRY_DATE;
100 | }
101 |
102 | @Override
103 | public int hashCode() {
104 | final int prime = 31;
105 | int result = 1;
106 | result = prime * result + ((id == null) ? 0 : id.hashCode());
107 | return result;
108 | }
109 |
110 | @Override
111 | public boolean equals(Object obj) {
112 | if (this == obj)
113 | return true;
114 | if (obj == null)
115 | return false;
116 | if (getClass() != obj.getClass())
117 | return false;
118 | VerificationToken other = (VerificationToken) obj;
119 | if (id == null) {
120 | if (other.id != null)
121 | return false;
122 | } else if (!id.equals(other.id))
123 | return false;
124 | return true;
125 | }
126 |
127 |
128 |
129 |
130 |
131 |
132 | }
133 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/persistance.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 | com.ramazan.bean.employee.Department
9 | com.ramazan.bean.employee.Employee
10 | com.ramazan.bean.employee.Job
11 | com.ramazan.bean.employee.Location
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 |
26 |
27 |
28 |
29 |
30 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/src/main/resources/database/database.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | true
80 | true
81 | creat
82 | org.hibernate.dialect.MySQL5Dialect
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------