beautypg.com

HP Integrity NonStop H-Series User Manual

Page 341

background image

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 sucesful");
}
if (session != null)
try {
session.close();

} catch (HibernateException e2) {
System.out.println("session close not sucesful");
}
}

}

}

After adding the necessary packages and the classes under them, the EmployeeInfo project
appears as follows:

Figure 17-11

shows the EmployeeInfo Project dialog box.

Overview of EmpIoyeeInfo

341

This manual is related to the following products: