package com.cv.hibernate.onetomany.annotation.model;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* @author Chandra Vardhan
*/
@Entity
@Table(name = "TBL_EMPLOYEE_ONE_MANY")
public class Employee {
@Id
@GeneratedValue
@Column(name = "employee_id")
private Long employeeId;
@Column(name = "firstname")
private String firstName;;
@Column(name = "lastname")
private String lastName;
@Column(name = "birth_date")
private Date birthDate;
@Column(name = "cell_phone")
private String cellphone;
@ManyToOne
@JoinColumn(name = "department_id", insertable = false, updatable = false, nullable = true)
private Department department;
public Employee() {
}
public Employee(String firstname, String lastname, String phone) {
this.firstName = firstname;
this.lastName = lastname;
this.birthDate = new Date(System.currentTimeMillis());
this.cellphone = phone;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
public Long getEmployeeId() {
return employeeId;
}
public void setEmployeeId(Long employeeId) {
this.employeeId = employeeId;
}
public String getFirstname() {
return firstName;
}
public String getLastname() {
return lastName;
}
public Date getBirthDate() {
return birthDate;
}
public String getCellphone() {
return cellphone;
}
public void setFirstName(String firstname) {
this.firstName = firstname;
}
public void setLastName(String lastname) {
this.lastName = lastname;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
public void setCellphone(String cellphone) {
this.cellphone = cellphone;
}
} |
No comments:
Post a Comment