52 lines
964 B
Java
52 lines
964 B
Java
package com.baeldung;
|
|
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.GeneratedValue;
|
|
import javax.persistence.Id;
|
|
|
|
@Entity
|
|
public class Employee {
|
|
|
|
@Id
|
|
@GeneratedValue
|
|
private Long id;
|
|
|
|
private String firstName;
|
|
|
|
private String lastName;
|
|
|
|
protected Employee() {
|
|
}
|
|
|
|
public Employee(String firstName, String lastName) {
|
|
this.firstName = firstName;
|
|
this.lastName = lastName;
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public String getFirstName() {
|
|
return firstName;
|
|
}
|
|
|
|
public void setFirstName(String firstName) {
|
|
this.firstName = firstName;
|
|
}
|
|
|
|
public String getLastName() {
|
|
return lastName;
|
|
}
|
|
|
|
public void setLastName(String lastName) {
|
|
this.lastName = lastName;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return String.format("Employee[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName);
|
|
}
|
|
|
|
}
|