Sunday 28 June 2009

Hibernate-ification

I decided to take the plunge today. Thanks to the magic of version control it's not an irreversable plunge but still a big one to take. I've decided to refactor the database code for AllDay DJ 3.

A few hours in and I'm most of the way there. That may be down to a bit of forward planning though - I designed the database code around the idea of "repositories". I.e. if you want to store or retrive something, you do it in the repository. Thankfully that all fits into the Hibernate approach.

Yup, I've gone for the complete ORM (Object Relational Modelling) approach. It has the upshot for users of allowing you to choose what database engine you want to use (providing it's supported by Hibernate) and as a developer, I see reduced development time and a better tie into the object model.

As with all things in life - there's a down side. Joins are a mix of being easier and more complex (depending on the object relationships). One specific example that comes to mind is the design I've got for the schedule. I won't give too much away, so let's just say the database schema in v3 is far more normalised.

No comments:

Post a Comment