This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In some situations, it is better to implement a single DAO for each data source. For example, if the application is using data-oriented web services then there would be a DAO for this data. And if the application also is using a relational database then there would be a second DAO for the database. In cases where there is more than one relational database, a DAO for each database works well.
Joined: Sep 03, 2008
in the end i just ended up creating a separate DAO & DTO for both the role(authority) and user table. I was really asking a coding style question. I am always curious to see if i am doing my programming the HIP and current way... I want to be like one of the cool kids...
I agree with the decision you ended up making (for what its worth).
With the functionality so finite and different, I would create 2 DAOs.
With that being said, there are times where I have created DAOs that query 2 or more tables, because I need a little bit of information from each to get all of the data I need.
In these cases, I thought it would be silly looking to have a method that is declaring and using 5 DAOs to get the data I needed.
Note: As you can tell I made my decision solely on looks.
I routinely work with very complex interrelationships and it has led me to develop a 2-tier persistency access architecture. The "service" classes access working sets of related tables and tend to contain persistence-related business logic. The "DAO" classes access individual tables and do the low-level find and CRUD functions. The service classes do not contain entityManagers. Instead, they invoke the DAOs. Transactions are bounded at the service level.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Sep 03, 2008
Thank you for all the incite... My code usually works but i always want to see what everyone else does...
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: one DAO querying 2 tables? (Spring security, user & auth)