Hibernate Generic DAOs
Warning: file_get_contents(http://feeds.delicious.com/v2/json/urlinfo/data?url=http%3A%2F%2Fstephennimmo.com%2Fblog%2F2008%2F01%2F02%2Fhibernate-generic-daos%2F) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 999 Unable to process request at this time -- error 999 in /home1/stephenn/public_html/blog/wp-content/plugins/digg-digg/dd.class.php on line 866
http://www.hibernate.org/328.html
This has been the slickest implementation of a generic DAO interface yet. I have used this exact implementation, with some small tweeks, in several projects and continue to try and expand on it's capabilities. This implementation provides almost plug and play functionality for all generic CRUD DAO calls just by creating a domain object, a DAO interface and implementation class.
So what work actually needs to be done? Hibernate Mappings (but that can either be annotized or completed via an IDE plug in - specifically, the hibernate plugin for Eclipse), creation of the three classes and then writing any custom finder methods.
The pattern begins to get a little convoluted when you start trying to manage complex objects so you may have to adjust your strategy.