I recently returned to Hibernate after my job took me away from it for a few years. I noticed that Hibernate Tools now produces DAOs (Home classes).
Being used to creating my own DAOs, this is nice. But looking at the generated classes, I see that they largely encapsulate the normal Hibernate atomic calls in a try/catch block, do some logging, and rethrow the exceptions. In your code you still have to catch the exceptions, manage transactions, and add other code that I'm used to have in my DAOs. In other words a lot of work still needs to be done when using them.
This strongly 'smells' as there being an intended pattern for modifying and/or using the generated DAOs.
I presume this pattern is documented somewhere... could somebody point me to the documentation that describes the pattern for using these generated DAOs, and if possibly also explain the 'why' of the pattern?
And if that documentation does not exist, perhaps provide an explanation or point to an example of 'proper use'?
Thanks,
b.
|