package dk.thoerup.hibertest1; import java.util.List; public class Example1 { /** * @param args */ public static void printList(List emps) { for (Employee e : emps) { System.out.println(" - " + e.getId() + " : " + e.getName() + " (" + e.getDepartment().getName() + ")" ); } } public static void main(String[] args) throws Exception { EmployeeDAO dao = new EmployeeDAO(); List list = dao.getAll(); printList(list); Employee emp = dao.getEmployeeById(3); dao.updateEmployee(emp); /* emp = dao.getEmployeeById(6); System.out.println("Employee #6 : " + emp.getName()); String search = "marC"; list = dao.getEmployeesByName(search); System.out.println("Employee named '" + search + "' : "); printList(list); Employee emp2 = dao.getEmployeeById(11); emp2.setName("Hello World"); dao.updateEmployee(emp2); emp = dao.getEmployeeById(12); if (emp != null) dao.deleteEmployee(emp); else System.out.println("no emp with id=12");*/ } }