Manual
Session session = sessionFactory.openSession();
Employee employee = new Employee();
employee.setEmpid(empid);
session.delete(employee);
session.flush();
return "Employee deleted";
Creating the Employee.hbm.xml File
Create the Employee.hbm.xml (Hibernate Mapping) file in EmpInfo/src directory to map
Java class with the database entities.
To create the Employee.hbm.xml file in the EmpInfo/src directory, complete the following
steps:
1. On the Project Explorer frame, right-click EmpInfo and select New > Other.
The New File dialog box appears.
2. From the list of folders, select XML > XML and click Next.
Figure 19-2 shows the New File dialog box.
Figure 19-2 New File Dialog Box
The New XML File dialog box appears.
3. In the File name field, enter Employee.hbm.xml and ensure that the parent folder is set
to EmpInfo/src. Click Next.
Figure 19-3 shows the New XML File dialog box.
392 Integrating Hibernate into Spring