Hibernate Tutorial

Hibernate tutorials

Hibernate, created by Gavin King, known as the best and dominated object/relational persistence (ORM) tool for Java developers (Now is support .NET). It provides many elegant and innovative ways to simplifies the relational database handling task in Java.

Hibernate is great at a lot of things, but its something that needs to be used appropriately. In this tutorials, it providing many step by step examples and explanations on using Hibernate3.

P.S Tutorials are updated to Hibernate v3.6.1.Final.

Hibernate Quick Start

Hello World example to experience the Hibernate framework.

Hibernate Association (Table Relationship)

How to define table relationship one-to-one, one-to-many, many-to-may in Hibernate.

Hibernate / JBoss Tools + Eclipse IDE

Learn how to use the Hibernate tools is a must!

Hibernate Logging

How to do logging in Hibernate

Hibernate Connection Pool

How to configure database connection pool in Hibernate

Hibernate Cascade

Hibernate cascade is use to manage the state of the other side automatically.

Hibernate Query Language (HQL)

Hibernate own language for the data manipulation, it’s quite similar to database SQL language.

Hibernate Criteria

Hibernate Criteria API is an alternative to Hibernate Query Language (HQL). It’s always a good solution in many optional search criteria.

Hibernate Native SQL

In some scenarios, Hibernate HQL or Criteria is just not enough to do what you want, here you can use the native database SQL language directly.

Hibernate Named Query

Named Query lets developers put the HQL into XML mapping file or annotation for maintainability purpose, you just do not want all your HQL syntax scatter all over the Java code. πŸ™‚

Hibernate Transaction

All things related to Hibernate Transaction

Hibernate Advance Technique

Some Hibernate Advance technique, seldom use but practical skills (data filter and interceptor).

Hibernate Performance

Some tweaks will make your Hibernate run faster πŸ™‚

Integrate Hibernate with Other Frameworks

Examples to integrate Hibernate with other frameworks.

Hibernate FAQ

Some frequence answer questions :

Hibernate Common Errors

Here are list of the common errors messages in Hibernate development.

Off Topic

Hibernate References

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
98 Comment threads
28 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
100 Comment authors
nagarajujohnkasuniVishwasMahesh Parmar Recent comment authors
newest oldest most voted
Murali
Guest
Murali

Hi Yong,
Is it possible to insert multiple records into child table but not in a single go(One to Many Mapping).
My parent table will always have one record,but my child table can have multiple records.
Pls.note not in a single go(I mean multiple requests to insert data into child table).
If possible,can you pls. share the example for the same?

gopala krishna
Guest
gopala krishna

what are the difference among HibernateUtil.getSessionFactory(), HibernateUtil.getCurrentSession(), HibernateUtil.openSession() ?

anji
Guest
anji

how to set the default values in SimpleFormController in spring mvc?

Diva
Guest
Diva

you can find some more details in the below link,”http://javadomain.in/multiple-databases-using-hibernate-example/”

Vusumzi
Guest
Vusumzi

Hi We have a web app using hibernate 3 and a sql server 2008 database. we have a table with query timeouts due to a deadlock caused users accesing the table at once when the query is called from the web app and also when I run the query in sql server it runs forever without returning data. So I ran the query in sql server with “with (no lock)” e.g “select * from Table table with(nolock) where (criteria)…” and it works perfectly….BUT when put “with (no lock)” in the query of my DAO implementation as follows: sql.append(“select count(*)”); sql.append(”… Read more »

Dilip Yadav Mahto
Guest
Dilip Yadav Mahto

nice tutorial..its an easy to understand each steps

Arun J
Guest
Arun J

Hi sir,I have done insert update delete using your jsf integration with spring and hibernate project but how can i search the values from database ?If am giving customerid then showing about that name and address in text box and textarea.

java PDF
Guest
java PDF

What are three programming languages that you think every programmer should know?

jagadish
Guest
jagadish

I gone through the notes and it is very good for begeers. ~Thanks,jaga

azhar
Guest
azhar

Hello is there a way to find if the table already exist in database before we create it using hbm files.

Moorthy
Guest
Moorthy

Yong. your tutorial is awesome. Thanks

Mauro
Guest
Mauro

Hi!
I’m Mauro from Buenos Aires. I just write to thank you for your tutorials, great job!

vinit
Guest
vinit

good tutorials of all framework.
thanks mr.yong

mannou
Guest
mannou

good tutorials
thank you very much

Venu
Guest
Venu

Do you have any example based on hibernate return insert?
Ref: http://www.it-eye.nl/weblog/2007/06/12/what-i-would-like-to-see-in-jpa-2/

jayaram
Guest
jayaram

tutorials are awesome
and very very good

Artem
Guest
Artem

you help me and many people, keep on, and thank you a lot for your tutorials

Mohan
Guest
Mohan

Hi.
we need More my friend form this site about hibernate and spring and also new version of technology as jsf materials can kindly set jsf also it possible it use to all the people

Sunil Verma
Guest
Sunil Verma

Perfect. Thank You.

Tousif Khan
Guest
Tousif Khan

Hi Yong.

Please write some article about Hibernate, Srtuts 2 and Spring integration.
Also write some good tutorial on Apache Axis (Web Services). This topics are still not covered will on Internet.

Regard
Tousif

Anand
Guest
Anand

Hi
I got one requirement where I am getting the XSDs.I have to use xmlbeans(for pojo class) and save the data by using Hibernate.I am new to both XMLbean and Hibernate.Please share any sample code based on xsds,xmlbean and hibernate.

Thanks in Advance

Shailendra Sonkar
Guest
Shailendra Sonkar

Its really a wonderfull tutorial… πŸ™‚

Anu
Guest
Anu

Hi,

Can you throw some light on Spring – iBatis integration?

Anu
Guest
Anu

Hi,

Can you throw some light on Spring-iBatis technology? I t wil be quite useful for me.And I went throw your spring tutorials, to say the fact, it was ASWEOSME!
Thnaks for such useful tutorials!

Jay Sharma
Guest
Jay Sharma

Hi Mkyong,

I think the collection of your tutorials is just great.

If possible can u please add a tutorial on level two caching in hibernate.

Caroline
Guest
Caroline

Hi Mkyong,

Thank you very much?Great posts! I found explainations are to the point, no verbose. great resource for young developers.
I come from china?I often find information in the United States website?I am a university student about to graduate?The site I will introduce it to more students and colleagues

I appreciate your selfless effort?

Kota
Guest
Kota

awesome tutorial. Helped me a lot

gulam samdani
Guest
gulam samdani

pls give a complete tutorial
how works hiberanate application with a simple example ?

Thanks

Suresh S
Guest
Suresh S

Hi,

This is by far the best tutorial site I have come across. Thanks for the wonderful information posted.

I was trying out your hibernate example (3.6). One of the downloads for ojdbc jar in pom.xml seems to be broken.
Here’s the error:
Failure to find com.oracle:ojdbc6:jar:11.2.0 in http://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of JBoss repository has elapsed or updates are forced.

I think we need to update the pom.xml with the suitable entry to get the jar file.

Cheers,
Suresh S

Suresh S
Guest
Suresh S

Hi,

I found this link which explains how to resolve this issue.
http://forums.oracle.com/forums/thread.jspa?messageID=4045926