• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DAO Pattern question

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic