Keep your ORM away from my objects
I’m increasingly of the opinion that object relational mapping tools are bad ideas. If you’re using a relational database, then use a relational database, don’t try to hide it or treat it like an object database, because it isn’t and ORMs are an incredibly leaky abstraction. My real objection comes down to this—don’t let your object model and your persistance mechanism mix. They’re two separate concerns. If you’re using OO, then get your object model right and don’t clutter it up or compromise it by mixing in persistance issues. I’ve seen way too many models where structure was sacrificed because of some odd ORM constraint that made life difficult to do it the right way. This is why I perfer a tool like iBatis which lets me use a relational database properly and still easily convert SQL results into objects without pain.
I could go on and on about ORMs, but I’ll leave more of that rant for later. But in all seriousness, if you’re using Hibernate or JDO or whatever, check out iBatis and, oh, get over your irrational fear of SQL. You’re using Java! Compared to that SQL is a walk in the park.


