Added Result

This commit is contained in:
Priyesh Mashelkar
2018-09-05 00:13:08 +01:00
parent 9efd6103ec
commit fbe433ebb4
4 changed files with 63 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
public class Department {
@@ -13,4 +14,22 @@ public class Department {
String name;
@OneToMany(mappedBy="department")
List<Employee> employees;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Employee> getEmployees() {
return employees;
}
public void setEmployees(List<Employee> employees) {
this.employees = employees;
}
}

View File

@@ -3,6 +3,7 @@ package com.baeldung.hibernate.entities;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
public class Employee {

View File

@@ -0,0 +1,27 @@
package com.baeldung.hibernate.pojo;
public class Result {
String employeeName;
String departmentName;
public Result(String employeeName, String departmentName) {
this.employeeName = employeeName;
this.departmentName = departmentName;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}