Tuesday, March 20, 2007
Ode to Hibernate
At each of my first two jobs I wrote an object-relational mapping framework in Java. The first was an abomination, the second merely rotten. I'm not the only engineer to have traveled this road. You write some code to generate SQL for your simple CRUD operations, you get one-to-many relationships working, and then you (and probably the rest of your team) spend a couple of months piling on hacks to support outer joins, many-to-many relationships, and all the other "extras" that are of course not "extras" at all. So imagine my mood the day a coworker introduced me to Hibernate (thanks Toby!). Just a few days of prototyping made it clear that Hibernate was an elegant solution to a hard problem, and that I would never again feel compelled to build an OR Mapping framework in Java. Joy.
As a fan of Hibernate it gives me great pleasure to announce the open-source availability of Hibernate Shards, a framework that adds support for horizontal partitioning (or in Google parlance, "sharding") to Hibernate Core. There are a number of reasons you might not keep all your data in a single relational database. Maybe you have too much data. Maybe a potential customer won't sign up for your service unless her company's data lives in its own database. Whatever your reasons, dealing with a sharded dataset adds complexity to the development and management of your application. Hibernate Shards is designed to encapsulate and reduce the complexity of building applications that work with sharded datasets.
I worked with Tomislav Nad and Maulik Shah (fellow Googlers who share my enthusiasm for Hibernate and Java infrastructure) to build Hibernate Shards as a 20 percent project. We think what we have now will be useful to the Java community, but this is most certainly not a polished release. There are functionality gaps to be filled, design warts to be smoothed, and bugs to be shaken out. We look forward to working with you as we address these issues and make Hibernate Shards even more powerful in the months to come. If you'd like to read more please visit the official Hibernate Shards website.