views:

161

answers:

0

I currently have the excercise at university to create several Java-entitys (Person, Employee, Department, DepartmentType, ...) handled by JPA which should be accessed by the client through some EJBs (I think that's best practice?!).

Now I think about how to organize/design the EJBs. Do you create one EJB per Entity? Or one EJB for all Entitys? What about related Entitys (like Department and Department Type?). What methods to access the Entitys do you create? How do you handle searching for Entitys (like Person, Employee, ...)?

I'm currently thinking about something like this, although I'm not very happy with it:

public interface EmployeeBeanRemote {
    public void createEmployee(Employee employee);
    public void editEmployee(Employee employee);
    public void deleteEmployee(Employee employee);
    public Employee getEmployeeById(Integer id);
    public List<Employee> getAllEmployees();
    public List<Employee> searchEmployee(not sure which params to use?);
}

Any help appreciated!