Posts

Showing posts from May, 2011

Type Safe Criteria API for Hibernate

I've started a library for a type-safe criteria API for Hibernate called SafeCriteria. I've always been bothered by the fact that the Criteria API always requires one to use text strings for the property names. Strings aren't checked by the compiler, so they can hide errors in your code until runtime, which is way too late. In short, SafeCriteria allows you to query via "showing" the API what properties you want via the getter methods for that property. The great thing is that the getter methods are checked by the compiler so you at least get some help there, and if you need to refactor a property getter the refactoring tools of your IDE will help you catch these references as well. I also have some ideas for handling class aliases better than with remembering strings in your property names, but that is coming after the basics are working properly. Maybe I'm just scratching my own itch here, but someone else might have the same itch. If anything, I'll a