The following procedures must be followed to create the first hibernate application in Eclipse:
You may create the java project by going to the File menu, selecting New, then selecting Java Project from the list of options. Please give it a title (firsthb, for example), and then click Finish to complete the process.
Add external archives by right-clicking on your project and selecting Build Path. Pick all the jar files in the image below and then click "Open".
Here, we create the same persistent class we have established in the previous topic. A persistent class can be designed by selecting src and clicking on New - Class.
We'll construct the same mapping file as we did in the last one on this topic. Right-click on src and select "new file" (e.g. employee.hbm.xml) to create the mapping file. Click "OK" to save the file. It must be on the outside of the package to be effective.
Username, password, and connection URL are all contained in the configuration file. A database table can be created automatically by setting hbm2ddl.auto to true. Dialect class will be discussed in more detail in future sections. Right-click on src and select "new" from the menu—type hibernate.cfg.xml as the name of the configuration file.
We are simply storing the employee object in the database with this class.