July 22nd, 2008 by Lincoln Baxter III

Guide to Hibernate Annotations

Is there light at the end of the tunnel?

So I’m sure I’m not alone here, when I say that Hibernate can be frustrating, difficult to learn, and may even feel like to use it means to give up on some design principles that have been proven by many. When you first begin, it feels like there are holes, inconsistencies, and problems that send you running home to the familiar behavior of plain SQL. But, I don’t think it’s time to give up on Hibernate yet. Keep in mind that I am a relatively new Hibernate user, I consider myself somewhat experienced with software development, design patterns, principles, and best practices. If this sounds like you, read on…


I’m beginning a series of articles that will:
  1. document my journey with Hibernate
  2. be a guide for those of you who are still on your journey
  3. give me a way to remember why I’ve made the decisions that I’ve made; what was I thinking??


Please look forward to the following topics that will start out this series.
  • Getting started quickly. (read it)
  • Using a base class to map common fields. (read it)
  • Criteria returning duplicate results in OneToMany relationships.
  • The Abstract Dao.
  • Keeping transactional behavior in a lazy world.
Also, feel free to comment on any of these topics, or request new topics. Remember to check the following resources; a lot of common problems can be solved by reading the hibernate FAQ.


For the purpose of these examples, please assume the following versions:


  1. Hibernate FAQ
  2. Hibernate Forums
  3. Java Persistence API

Posted in Hibernate, Java


  1. Tired of faraonic bullshits like Spring, Hibernate, et al. says:

    Over 400 pages just in the Core Reference Manual. And that’s only the beginning.

    When a framework, not matter which, has a core reference manual over 400 pages you know it’s not a framework, it’s a problem. It’s a f*cking monster. Hibernate is like everything else in Java: bloated, cumbersome, galaxy-wide, mind-blowing complex… and what about the message errors? Simply unreadable.

    Hibernate-like frameworks are NOT an asset. They are a horrible liability. Long live JDBC.

  2. Rick says:

    I using pure JPA for now.
    Waiting for JDO to mature, if it ever.

    Using Hibernate, is like using a huge hammer to fix an century old problem which should not be there in the first place.

Leave a Comment

Please note: In order to submit code or special characters, wrap it in

[code lang="xml"][/code]
(for your language) - or your tags will be eaten.

Please note: Comment moderation is enabled and may delay your comment from appearing. There is no need to resubmit your comment.