Hibernate ain’t sleeping[20050703]

Gavin King gave his Hibernate 3.0 talk twice at the Convention. Much of what he covered can be seen by grabbing the release. I am just covering items of interest to my workspace.

First, there is the use of Java 5 annotations to do the mapping. XML mapping is still supported, but the annotations follow the EJB 3.0 specs (duh considering that Gavin is a lead on that spec). I am of two minds about this. Points in favor of making the move to annotations are:

  • Mappings are part of the class.
  • We will be EJB 3.0 ready, so we can move to a different entity management system.

Counter points are:

  • What happens when you change the names of fields and tables? You will have to fall back to XML mapping anyway.
  • Time and testing (as always)

I enjoyed the time taken on association fetching, considering which are the most efficient. That will be something I have to review in our current deployment. Sub-select fetching looks the best, but my big thing is trying to prevent to much data grabbing.

Finally, filters is definitely something to look into. Our system is all about only showing people the content they can access. Right now, every query we always include checking tables defining that access. It would be great to write it once. I should have asked if we could define our own filter classes, instead of the XML/SQL definitions that were demonstrated.