Author image

Hibernate Object Relational Mapping (ORM) Tutorial


Hibernate is a Java open source, lightweight & performant ORM framework that simplifies the development of Java server applications when interacting with a database. ORM stands object relational mapping. It maps between an Object oriented language (Java here) and a Relational language (SQL), to execute database queries in an OOP way rather than using SQL.

This demo provides all you need to get setup in Java with your database queries. The main pieces of code are 4 .java files in src\main\java\ directory. The queries are database independent though and they can work no matter the database backend. I've tested this to be true on MySQL and SQLAlchemy. This is accomplished by HQL (Hibernate Query Language) the object-oriented version of SQL which Hibernate converts to SQL under the hood.

orm hibernate demo

I definitely recommend the Hibernate framework to those working with server/database applications in Java.

I have developed this demo on my Windows 8.1 x86_64 computer, using IDEA 2018.1 and for the SQL database side I've used XAMPP v3.2.2 and MySQL on port 6180.

This is not a documented tutorial on Hibernate but rather a host article for the project. For a tutorial see this excellent one, or, if you're the visual learner watch (a part) this YouTube playlist. My project can be a supplement on your educational journey and is commented out so you can follow along.


Github repository link.