DAO design pattern and using it across multiple tables
Posted
by Casey
on Stack Overflow
See other posts from Stack Overflow
or by Casey
Published on 2010-03-24T02:00:18Z
Indexed on
2010/03/24
2:03 UTC
Read the original article
Hit count: 273
I'm looking for feedback on the Data Access Object design pattern and using it when you have to access data across multiple tables. It seems like that pattern, which has a DAO for each table along with a Data Transfer Object (DTO) that represents a single row, isn't too useful for when dealing with data from multiple tables. I was thinking about creating a composite DAO and corresponding DTO that would return the result of, let's say performing a join on two tables. This way I can use SQL to grab all the data instead of first grabbing data from one using one DAO and than the second table using the second DAO, and than composing them together in Java.
Is there a better solution? And no, I'm not able to move to Hibernate or another ORM tool at the moment. Just straight JDBC for this project.
© Stack Overflow or respective owner