Here I just want to save for my future work, how to create very simple java hibernate application.
When you created a simple Project in NetBeans, you also must add necessary libraries, otherwise, the annotations in the Java Classes won't work.
When the libraries are added and classes are written we can create the hibernate.cfg.xml File. This file will have all the configuration details about the hibernate connection and, of course, persistent objects which were mapped into the Database.
To create a new Hibernate Configuration File just go to your project in the project explorer and right click on it:
New --> Other (it is at the bottom).
When a new window shows up, choose of all options on the left side XML.
Under XML select XML Document.
Enter a new name for the file (by convention it is: "hibernate.cfg") and put it into the root folder.
Click "Next" in the Wizard Menu.
When you have to select the Document Type, choose DTD-Constrained Document and click "Next".
Now there are three fields to be filled with IDs and other.
In the first one leave the input as it is.
DTD System ID could be the following:
http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd
when inserted this, choose the Document Root. In our case for the configuration file we will choose:
"hibernate-configuration".
Click on "Finish" and now you have the valid configuration file for hibernate.