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

Tags :

About the Author

mkyong
Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

  • Pingback: water purification systems()

  • Pingback: alkaline water()

  • Pingback: tv online, online tv()

  • Pingback: tv online, online tv()

  • Pingback: watch free movies online()

  • Pingback: watch free movies online()

  • Pingback: YouTube Video()

  • Pingback: Blue Coaster33()

  • http://codyveit.tumblr.com Cody Veit

    Thanks for sharing. You’ve saved me days of Googling effort.

  • Jay

    I always read your blogs and tutorials.

  • Premkumar

    is it possible to execute a sql query with the help of hibernate

  • Premkumar

    i have doubt is it possible to execute a sql query with the help of hibernate

    • Saood

      Yes We can execute a sql query with the help of hibernate

      Query query = session.createSQLQuery(“Write Query here”);
      //If some parameter to be passed
      query.setParameter(0,value1);
      List list = query.list();

  • shashi kant sharma

    Superb…. Boss

  • http://javadomain.in Diva

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

  • http://vgtmcity.com Venkat

    Hi , BuildSessionFactory also deprecated , so i think its better explain about it also..Thank you

  • anji

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

  • anji

    how to resolve org.hibernate.LazyInitialiazationException?

  • Pingback: hibernate ?? | demonstrate ? blog()

  • Balu

    hello sir your java/j2ee concepts r really useful & powerful.thanq very much sir

  • Rahul

    Hi MK,

    Great tutorials always ! I am waiting for hibernate annoatation configuration with entity manager configuration tutorials. I am having some issues in the entity manager configuration.

    :)

    Thanks !
    Rahul

  • Ravi

    Hi Yong,

    Hope u r fine. I need 1 help. I want to configure multiple database using Spring nd Hibernate. Can u help me in this please.

    I will wait for ur valuable reply to my mail.

    Thanks
    Ravi

  • Reddy

    Thanks Mkyong team for the tutorials. Can you please add an example for Hibernate “Session in view pattern”(Extended Session). I guess this is used in many real time projects. Could find any good examples like yours . Can you enlighten us on this.

  • lucky

    Please help me.. can you explain more in hibernate, if i want to use annotation, but using persistence.xml on my config (not use hibernate.cfg.xml and hbm.xml).

  • Ashish

    i want Hibernate Pagination example in java which shows results in jmesa on jsp.
    please help me

  • Priti

    hey, thanks for the excellent collection of Hibernate collection.
    I have no idea about Maven still able to run all the examples in eclipse.

    Thank you so much!

  • http://[email protected] Ram

    Please provide us Hibernate 4 tutorial

  • genffe

    thanks for all of these tutorials,i need all of them.

  • gopi

    hi sir,
    how to fix the org.hibernate.SQLGrammer Exception:could not update next value

  • tringer

    Sir,

    can you please post some examples of caching with hibernate.
    That would really help.. either with ehcache/ OSCache.??

    and its usage in a distributed env.
    Thank you.

  • Mateen

    Hi,

    Could you please show an example of using JAX-RS and Spring and Hibernate Example. I followed your JAX-RS and Spring example and it worked liked a charm. Now i want to add JPA to this. Could you please upload an example of doing this.

  • Nikhil Borpe

    What is the use of SessionFactory class object in Hibernate?

    • bharath

      sessionfactory the name itself says its a factory…

      It is used for creating the objects for session..

    • SyedThayeefAhmed

      SessionFactory sessionFactory=config,.buildSessionFatory();

      It is heavy weight Component.By using that class object we can create sessions.

    • Saood

      SessionFactory is an interface and SessionFactoryImpl is its implementing class. It is SessionFactory which load entire configuration file. All data in configuration file are loaded into a variable and thse variable group together are high level Hibernate object or we can say SessionFactory. SessionFactory is responsible for opening session.

  • http://[email protected] muralidharan

    Hi how i can create hibernate database.properties file..please help me..

  • Ping4u

    Hi mkyong,

    In url: http://www.mkyong.com/spring3/ page navigation is not working. whenever I click on page navigation it is opening jquery site instead of http://www.mkyong.com/spring3/page/2.

    The same page navigation issues is with your hibernate also.
    http://www.mkyong.com/hibernate/page/2

    Please fix the page navigation issue in your site: http://www.mkyong.com/hibernate

  • Deesmon

    I’m new in all of this, I have to debug an interface which extract data from a PostgreSQL Database.
    Correct code from stranger is hard, even more when you discover some new concept.
    Your tutorial help me a lot.
    Thank you.

  • SIddhant

    Hi Sir,
    I have gone through the hibernate documentation and I found some term like Proxy its difficult to understand .And I have doubt on cache starategy ,locking strategy and flushing strategy ..can u please add one one section on that..If u explain all enum constant of CacheMode,LockMode,FetchMode its help full for us….

  • SIddhant

    Hi Sir,
    I have gone through the hibernate documentation and I found some term like Proxy its difficult to understand .And I have doubt on cache starategy ,locking strategy and flushing strategy ..can u please add one one section on that..If u explain all enum constant of CacheMode,LockMode,FetchMode its help full for us….

  • anoo

    hi, mkyong……
    ..your’s tuturials is quite good and helpful……….
    1)would you expalin me inherintance in hibernate with examples?
    2)and what is session factory in hibernate…..would you expalin me in details?
    3)and what is dirty checking in hibernate?

    • Saood

      session.isDirty() method is used to check whether some data is still pending to be flushed to Database or not. If you call session.flush(); first then isDirty() method will return false.
      SessionFactory is an interface and SessionFactoryImpl is its implementing class. It is SessionFactory which load entire configuration file. All data in configuration file are loaded into a variable and thse variable group together are high level Hibernate object or we can say SessionFactory. SessionFactory is responsible for opening session.

  • Pingback: Spring and Hibernate » Agile Mobile Developer()