In this section a middle-tier Hibernate Java application is developed to add/update and delete data to the table generated from the mapping file, catalog.hbm.xml
. The Java application is not the JavaBean class generated from the mapping file. The Java application integrates the JavaBean class generated from the mapping file, the mapping file, and the properties file to provide a database persistence and query service.
Select File | New and in the New Gallery window select General | Java Class. In the Create Java Class window, specify a class name, HibernateDB.java, and a class package, hibernate. A Java class is added to the Hibernate project. Next, copy the mapping file catalog.hbm.xml
and the C:/Hibernate/src/hibernate/Catalog.java
java bean class to the hibernate
directory. The directory structure of the Hibernate application is shown in following figure.
To the project libraries add the directory containing the hibernate.properties
file. Also add...