Hello,
i have implemented the DAO
pattern based on what i have found on the web.
My basic JPA DAO implementation looks something like this:
And for custom DAOS:
I Decouple the transaction handling from the
JDBC operation methods, so if i need several calls in a transaction i can wrap them with the corresponding begin/end calls. This unfortunately leads to messy code when i just need to make a single JDBC call for example:
You see the problem. I have the overhead of session/transaction code for a single create call. It would be nice to manage this code so that i could do the following:
Where ManagedUserDAO implements a DAO which wraps the tranactional code and then calls the actual DAO objects create function. But this introduces a new problem: I need to create a separate ManagedDAO for each Implementation! So this is no option.
Could you give me some hints to solve this problem?
Thanks in advance!
[VK: Removed an unnecessary tag]