onsdag 31 oktober 2007


So you have realised that it would be great to store your java objects in a database and you have heard that Hibernate will do exactly that for you? And you won't even need to think about the database, just design a great class model and store it using Hibernate? Easy you think?

Wrong! As you may already have figured out from the title of this Blog in my experience it isn't really that easy at all. But let's start from the beginning.

A little bit more than a year ago now I started a project using Hibernate. Some of my friends warned me and showed me a frightening text about the Vietnam of Computer Science -- that is: the ORM problem.

The problem for me was such a real one and such an important one that I couldn't really find another solution. I had my java classes and I needed to persist them in a database. No matter what other people had to say about it that was what I needed to do. I guess that was my first steps along what would be a long road...

The first and most important thing you need to realise is that Hibernate makes it look easy -- especially the books about Hibernate makes it look very easy. It is not that easy! In fact it is a very complicated problem. Once you have realised that it is much easier to live with all the problems that will turn up.

I intend to write about how I learned to stop worrying about all the strange things I did to get it to work and how I learned to love the Object Relational Mapping business. But bear with me because it was almost a year ago that I did some of the stuff and in the light of time I might not remember the exact order of things and not all of the darkest times.