Hibernate ORM - learn to create first application
Hibernate ORM 184.108.40.206 finally had been released and it can be downloaded from the assigned page shown in the video. Here we will learn how to create the first application using the Maven dependencies Hibernate 220.127.116.11 was released on 3rd October 2015.In this tutorial we will be taught how to create CRUD application using Maven tool in Eclipse IDE. We will be able to learn how to use the Maven dependencies of Hibernate ORM 18.104.22.168 in pom.xml file .The latest version of eclipse Luna 22.214.171.124 was used.
Here is the video tutorial of "Hibernate ORM 4.2.21 released - Learn to create first application":
We have the following fixed bugs in this version of Hibernate :
[HHH 5255] – Merge detached entity failed when the instrumental lazy property is initialized.
[HHH 7573]- Lazy properties are not processed properly after pre update call back.
[HHH 9928]- Pending put leaks when the entity is not found in DB.
[HHH 10182]- Back port HHH – 7898 and HHH -10005 for JTA environment only.
Now a project will be created and we will be shown how can we create our first CRUD application in Hibernate.
- At first a simple java project was created and it was named Hibernate 2.21 CRUD and then next was clicked followed by finish and thus this project was ready.
- Now the Maven dependencies will be added.Now this project will be converted to Maven project. By the right click we go to the option configuration – convert maven project. And then finish was clicked and finally this file is ready. Now the Maven dependencies will be added . So from project it was copied and pasted. We had been using Hibernate validator 4.2.0 final and My SQL connector.
- Now the database will be created The file hibernate.xml file was copied from the project. If it is opened we will see that that it is connecting the hibernate fold database and the MySQL dialect whose username and password is “root”. Here an employee entity is used. And thus the record was edited and stored.
- And we finally create a package by clicking on SRC followed by new and then package and the file name was entered. The employee entity was then copied. We find all the details of the employee : employee key, mobile no , address etc.
- Another new package was created like wise . Thus session factory, configuration ,service registry, with which the session factory was creates. It was then run as java application and thus a new data was added and also a new record.
- The first entity was loaded and updated and the values were changed.
- To delete the data we have session delete. It was again run as and check out if the data is deleted or not.
- “Criterea” can be used to load all the objects from the database and for this a criteria was created by using session .create criterion. When we run it as Java application then the first two records were displayed.