Open Source Java Frameworks on NonStop User's Guide (Spring 3.0.2, Hibernate 3.5.1, MyFaces 2.0.2, Axis2/Java 1.5.2)
Employee emp = null;
do {
if (emps.hasNext()) {
emp = (Employee) emps.next();
System.out.println("----------" + emp.getId());
System.out.println("----------" + emp.getFname());
}
} while (emps.hasNext());
return (emp);
}
public void createEmpl() {
try {
tx = session.beginTransaction();
Employee emp = new Employee();
emp.setAge(23);
emp.setFname("Test");
emp.setLname("Data");
session.save(emp);
tx.commit();
} catch (HibernateException e) {
if (tx != null)
try {
tx.rollback();
} catch (HibernateException e1) {
System.out.println("rollback not successful");
}
}
}
After adding the necessary packages and the classes under them, the EmployeeInfo project appears
as:
208 Getting Started with Hibernate










