Author image

Hibernate Object Relational Mapping (ORM) Demo


Difficulty:
2/5


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 for object relational mapping. It maps between an Object oriented language (Java here) and a Relational language (SQL) in order 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 with 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 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 tutorial on either Hibernate or ORMs, 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

Github repository link.


0 likes