User Manual

EntityEmployee entityEmployee = em.find(EntityEmployee.class,
new Integer(empid));
em.remove(entityEmployee);
em.flush();
t.commit();
return "Employee deleted";
}
}
Removing the Employee.hbm.xml File
JPA annotations (EntityEmployee.java class) have been used to map the database entities.
Hence, the Hibernate Mapping file (Employee.hbm.xml) is no longer needed and is removed.
Adding Dependency JAR Files
Adding the dependency JAR files involves the following tasks:
1. “Downloading Hibernate Entity Manager” (page 391)
2. Adding Dependency JAR Files” (page 391)
Downloading Hibernate Entity Manager
To use JPA with Hibernate, the javassist.jar and ejb3-persistence.jar dependency
JAR files present in the Hibernate Entity Manager package must be downloaded.
To download the Hibernate Entity Manger, complete the following steps:
1. Go to http://sourceforge.net/project/showfiles.php?group_id=40712&package_id=156160
A page displaying a list of Hibernate Entity Manager Releases appears.
2. Click 3.2.0.GA Release.
3. Click hibernate-entitymanager-3.2.0.GA.zip and download it to a location on the
Windows system.
4. After the download is complete, unzip the hibernate-entitymanager-3.2.0.GA.zip
file to a location on the Windows system.
For example, this location could be <Hibernate Entity Manager Home>.
Adding Dependency JAR Files
To incorporate the features of JPA in the EmpInfo application, the following JAR files, other than
the ones added while developing EmpInfo application, must be added in the EmpInfo project
library.
Table 12 Dependency JAR Files
Source LocationDependency JAR Files
<Hibernate Repository Home>\org\
hibernate\com.springsource.org.hibernate.ejb\
3.4.0.GA
com.springsource.org.hibernate.ejb-3.4.0.GA.jar
<Hibernate Repository
Home>\javax\persistence
\hibernate-jpa-2.0-api\1.0.0.Final
hibernate-jpa-2.0-api-1.0.0.Final.jar
<Hibernate Repository
Home>\javax\persistence
\com.springsource.javax.persistence\1.0.0
com.springsource.javax.persistence-1.0.0.jar
<Hibernate Repository Home>\org\
hibernate\hibernate-entitymanager\3.4.0.GA
hibernate-entitymanager-3.4.0.GA.jar
Example of Integrating JPA with Hibernate into Spring 391