How to use Hibernate 4 with MySQL

Hibernate is an ORM (Object-Relation Mapping) tool for Java. It is used to persist and fetch data in the database via mapping the software objects to the relational model where properties of a class are mapped to a column in a table, class or an entity is mapped to table and instance of a class is a new record in a table.

This document explains the process of creating a simple Java application which uses Hibernate version 4, to store and retrieve data from MySQL database. It also explains how to create a simple MySQL  DB using XAMPP.

It is believed that the reader has a general idea of Eclipse IDE and Java.

Installing XAMPP and starting MySQL

There are various ways in which MySQL can be installed locally, namely:

I prefer using XAMPP, because it installs many other things like myPhpAdmin, Apache, FileZila, etc. and it’s free!!

Continue reading “How to use Hibernate 4 with MySQL”