Adds findAll methods to Projects and Employees

parent 03e5a310
...@@ -12,6 +12,10 @@ public class Employees { ...@@ -12,6 +12,10 @@ public class Employees {
this.em = em; this.em = em;
} }
public List<Employee> findAll() {
return this.em.createQuery("SELECT e FROM Employee e").getResultList();
}
public void addNewEmployee(Employee e) { public void addNewEmployee(Employee e) {
this.em.persist(e); this.em.persist(e);
} }
......
package dgpena.siexample.persistence; package dgpena.siexample.persistence;
import java.util.List;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
public class Projects { public class Projects {
...@@ -10,6 +12,9 @@ public class Projects { ...@@ -10,6 +12,9 @@ public class Projects {
this.em = em; this.em = em;
} }
public List<Project> findAll() {
return this.em.createQuery("SELECT p FROM Project p").getResultList();
}
public void addNewProject(Project p) { public void addNewProject(Project p) {
em.persist(p); em.persist(p);
} }
......
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