Hibernate tutorial

Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions.

In this article I will show you how can you use Hibernate 4,  along with a simple example application available to try out what you read about.

In this article I will introduce the annotation-based configuration, where you can use Hibernate’s annotations on the entities to reduce the amount of XML needed.
In previous article we introduced annotations instead XML configuration. Now I will dig deeper and show how you can create entity relations and map them to the database.
As you already know, objects can inherit from each other to move common functionality into a superclass and have only the different parts in the children. The same can be achieved with Hibernate too: you can group common functionality to a parent class and add only the differences to the children — and you can map this relation to the database too.
After the introduction into Hibernate 4 which included mapping relationships and inheritance let’s dig a bit deeper and see how we can reach stored data in the database.
Till now we have used in memory DB. Here in this article i will show you how to switch to another database which actually persists the data and you can retrieve it later, and what you have to re-configure to make things work like you expect.
In this article I will give you a brief introduction to Hibernate batch processing.
If you have a bigger application you think about performance and how you can improve it. Caching is one way to do this because it enables less queries going to the database. Querying the database is always a performance impact because it is an I/O operation. And I/O operations are much slower than operations using only the applications memory.
In this article I will give you a brief introduction to Entity auditing with Hibernate, or to be more specific with Hibernate Envers which is since some 3.x version part of the Hibernate core.
Most of the time it is OK to simply let the database do the work of concurrency control, however sometimes you can encounter an application where you need to take over.
Multi-tenancy indicates an approach in software development where a single application simultaneously serves multiple clients. These clients are also called tenants. This approach is very common in Software as a Service (SaaS) solutions.
We have arrived at a state with Hibernate 4 where we can change the database behind the system to go for production usage (so H2 databases are out of the question).

1 Comment Hibernate tutorial

Leave A Comment

Your email address will not be published. Required fields are marked *