Have you been looking for tutorials to understand Hibernate better?? Is there a project deadline coming up and you are nowhere close to completing even the Data Access Layer?
Ok, Here are some tutorials for understanding Hibernate. But there is one thing you must understand – Using Hibernate alone and using Hibernate with JPA are two different things. I realised this after reading these tutorials. Hibernate can be used in two ways –
1. As a means to connect to database, and also as a means to fetch data from there. You will use
import org.hibernate.Session; for the initial settings and
import org.hibernate.Query; to create the queries for the data.
If you dont use these in your files, then you are NOT using hibernate to fetch the data.
2. The other way of using Hibernate is to use it in combination with JPA, Java Persistence API. Hibernate connects to the database, and maps to objects, and JPA is used as a means to fetch data. This will mean you will write your queries in JPQL and not HQL. What is the difference between the two? It seems to be subtle, I will write about it when I actually find it.
Remember if you use the following
then you are using JPA. And these tutorials are for Pure Hibernate – Type I discussed here.
Without further ado, here is the link for pure Hibernate implementation –
Each of these are PDF files, and have been written in simple english language
If you want to understand JPA, JPQL, and how Java Persistence API is used in a typical example, you must read these two links – these are awesome examples –
You cannot copy paste ideas from these examples, you will have to understand the concept and apply it relevantly to your application.