Commit 1a019831 by Patryk Czarnik

LocalDate

parent aee5c0e3
...@@ -3,8 +3,7 @@ package hr.model; ...@@ -3,8 +3,7 @@ package hr.model;
import java.io.Serializable; import java.io.Serializable;
import jakarta.persistence.*; import jakarta.persistence.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.time.LocalDate;
/** /**
* The persistent class for the employees database table. * The persistent class for the employees database table.
...@@ -32,7 +31,7 @@ public class Employee implements Serializable { ...@@ -32,7 +31,7 @@ public class Employee implements Serializable {
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name="hire_date") @Column(name="hire_date")
private Date hireDate; private LocalDate hireDate;
@Column(name="last_name") @Column(name="last_name")
private String lastName; private String lastName;
...@@ -92,11 +91,11 @@ public class Employee implements Serializable { ...@@ -92,11 +91,11 @@ public class Employee implements Serializable {
this.firstName = firstName; this.firstName = firstName;
} }
public Date getHireDate() { public LocalDate getHireDate() {
return this.hireDate; return this.hireDate;
} }
public void setHireDate(Date hireDate) { public void setHireDate(LocalDate hireDate) {
this.hireDate = hireDate; this.hireDate = hireDate;
} }
......
...@@ -18,7 +18,7 @@ public class OdczytajWszystkich2 { ...@@ -18,7 +18,7 @@ public class OdczytajWszystkich2 {
List<Employee> lista = query.getResultList(); List<Employee> lista = query.getResultList();
for(Employee emp : lista) { for(Employee emp : lista) {
System.out.println(emp.getFirstName() + " " + emp.getLastName() + " " + emp.getSalary()); System.out.println(emp.getFirstName() + " " + emp.getLastName() + " " + emp.getSalary() + " zatr. " + emp.getHireDate());
} }
em.close(); em.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment