Hibernate

High-Performance Hibernate Tutorial

I’ve been using Hibernate for almost a decade and I admit it was not an easy journey. This tutorial is actually a summary of my book, whose main goal is to provide guidelines and practical advice for optimizing the data access layer performance while maintaining a strong consistency transactional model.

This material is useful for both beginners and experienced developers, going beyond the reference documentation.

Tips and best practices

Bootstrapping

Mappings

Basic types

Equals and hashCode

Relationships

Advanced mapping techniques

Identifiers

Inheritance

Connection management

Flushing

Fetching

Concurrency control

Batching

Caching

Queries

Stored procedures

Audit

Testing

If you like these articles, I bet you are going to love my book as well.

Testimonials

Enter your email address to follow this blog and receive notifications of new posts by email.

Advertisements

11 thoughts on “Hibernate

  1. Hi Vald,

    Thanks for providing these high quality tutorials around hibernate and JPA. They are very intuitive and useful. I went through most of the tutorials and couldn’t find anywhere you talked about mapping strategies(Per table, per class hierarchy etc…). Can I assume you are going to talk about those in a later tutorial or you always work with a 3rd normal form database schemas?

    Thanks,
    Paul

    1. When it comes to mappings, I always prefer simplicity. While you can model very exotic relations, those are very difficult to tune and they usually perform badly. For inheritance, I like to push the composition as much as possible. That’s why I don’t go for complex inheritance hierarchies, but rather have a common base entity which can easily swap in simpler many-to-one inheritance hierarchies. This resembles the JOINED inheritance, only it allows you to change from one type to the other without the base class primary key reusing hassle.

      1. Make sense.
        Most of the time, I go for the simple composition rather than inheritance.

        Cheers,
        Paul

  2. Hi Vlad,

    I have a question about using java 8 with Hibernate 3.2.2.ga version. We tried but the javassist bytecode enhancement (or rather the ByteCodeProviderImpl class of Hibernate) generates class files which do not pass the strict class checking of java 8.

    When upgrading to java 7 we got away by using -XX-useSplitVerifier shutting the new verifier up. But this option is no longer available in java 8. I now tried -noverify which seems to work but is rather a big hammer and I would rather have a more elegant (and safe) solution.

    We could upgrade hibernate to a more recent version, say 5.x but this would mean a lot of work and impact and I will only consider that if there really is no other option.

    What would you recommend?

    With kind regards,

    Indra

  3. Hi Vlad,

    Thanks for sharing good tutorials on Hibernate concepts. They are really helpful.
    Need your help in understanding more on how Hibernate behaves in JEE Clustered environment.

    Thanks,
    Pavan Kumar

  4. Hello Vald,

    Much obliged for giving these amazing instructional exercises around rest and JPA. They are extremely natural and helpful. I experienced the greater part of the instructional exercises and couldn’t discover anyplace you discussed mapping strategies(Per table, per class order and so on… ). Can I accept you will discuss those in a later instructional exercise or you generally work with a third typical shape database outlines?

    Much obliged,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s