Harder to find power than WiFi Toilet Humour
Jan 11

Hibernate 2/3, XDoclet 1/2, and Annotations

Tech Add comments

We are in an interesting time for some technologies. For example, if you are starting a project now in which you want to use Hibernate, and you want to annotate your model rather than using XML, then you have some choices:

  • Hibernate 2.*, XDoclet 1 (Stable): This is the stable choice. Tried and true. Hibernate 2.* is pretty stable, as is XDoclet 1. However, they aren’t getting as much attention as the new kids on their block.
  • Hibernate 2.*, XDoclet 2 (Quick fix): There have been certain cases where XDoclet 1 + the hibernate module for it, can’t generate the Hibernate mapping files the way I want them. Some of these have revolved around inheritence heirachies that muck with implementing interfaces. These problems have actually been fixed, but fixed in XDoclet 2. The problem here though is that X2 is far from a release, and although I built it and it works well, it seems a little scary to jump down that road now. Also, depending on what else you are generating with XDoclet, you may not be able to make the jump since all of the functionality hasn’t been ported from X1
  • Hibernate 3, Annotations (New World): As Gavin has said, Hibernate3 is what has been in the works for the last year or so. We have a beta which seems pretty stable (for a beta), and as well as the EJB 3 annotation support, they just released enhanced annotations for hibernate specific functionality support too. To make this jump, you are assuming that a stable H3 will be around by the time you get further down the road in your project, OR maybe it is just a pet project to play with. You also get to make the leap to Java 5 to play with the full on annotations, although of course you can stick with 1.4 and use other means. The nice side-effect of the annotations support is that you don’t have to go into your build and tweak it out to have that extra xdoclet step.

So, we are at an interesting transition point at the moment. A lot of people are waiting for EJB 3. A lot of people are wondering when to make leaps of faith. And there are a lot of options on putting together these technologies.

Comments are closed.