This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hellow guys, I'm currently on learning using Dao pattern in my project. So as what I know, one Table is equivalent to one DAO, am I right? just like StudentDao, SubjectDao. Each dao performs crud operations in their associated tables. But my question is , how am I going to create a DAO for joined tables? lets say I have a query to join student and subject table, then how do I create a DAO for that? Should I place it to the StudentDao? or to SubjectDao? or there's a good practice in that kind of situation?
my take is it is really upto you on where to put such method, but you may want to consider cohesion, for example, if you are querying for the name of students that are enrolled to a specific subject then you may want to consider to put that in the SubjectDAO because your result makes sense to be coming from such class than from StudentDAO. Having the method name something like "getStudents(String subject)" will also help you decide. Hope this helps.