Thoughts on Hibernate and JDO
I’ve been using Hibernate for many years, but only recently did I decide to take a look at JDO. It was Pojos in Action that had me investigating JDO (the book actually covers both technologies).
Anyway, I really like it so far, though I’m not really thinking of switching to it (yet). I’m using the JPOX implementation for the moment, but if rumours are true, I may also try KODO.
From what I’ve seen so far, both technologies have similar capabilities. JDO has this nice idea of fetch groups though, which is useful if one does not want to use the open-session-in-view pattern (or the exposed domain model as Pojos in Action rightfully calls it). But JDO also imposes an enhacement stage in your code-compile-deploy(test) cycle. So, assuming similar capabilities, how can we compare these two?
Well, we can first take a look at each API and secondly compare performances.
- In this case, the APIs are quite similar. At least for typical usage, I would say that the only thing that differs is the naming of some objects and methods. And as is, I prefer JDO’s PersistentManager, makePersistent(), detachCopy() to Hibernate’s Session, save(), initialize()
- Regarding performance, I don’t yet have an opinion of my own nor by others. I will try to find articles on this + do my own tests – after all it’s just a mater of writing new DAOs and changing a few Hivemind configurations. But anyway, this looks like a difficult battle for Hibernate. Hibernate is really up against a specification here, which means it has to compete with every single JDO implementation.
I wouldn’t dare making any predictions on what will happen (i’m not even familiar with Hibernate’s or JDO’s future roadmap). But what if Hibernate eventually becomes YAJI (yet another jdo implementation) ? Would this be bad for us users?