Results 1 to 5 of 5
- 07-24-2010, 12:03 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
Confusion about DAO in Three-Tier Architecture!
Hello all!
Dear Members my question is related to Software-engineering approach about DAO (Data Access Object) in three tier architecture.
Am a student and as for the final project of my course I had to develop a three tier web based application..
the approach I choose for my project was I divided my classes into three layers as required by the architecture including a DAO Control class.
and my DAO class has only one function which takes query as in string format from Entity classes and then return the result Set of that query in return.
->* public ResultSet getConnected(String query, int qType) { ... }*
but one of my supervisor said that architecture demands the DAO should be independent from any external interference and the way you are providing query from outside is violating that rule so either store all the queries inside DAO or inherit all the class from DAO.
but I m still a bit confused about it that how it violates the rule and what is is ideal scenario in which DAO shld be used.
please Help, suggest. :)
Thankyou!
- 07-24-2010, 01:45 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
A DAO layer takes care of all database intrinsics and hides that fact from the outer layers. Your DAO demands that an outer layer knows about SQL queries and result sets. It might be quite general but that's not the way a DAO is defined. It should have methods such as getEmployee(String empID), getEmployees() etc. The DAO is designed with the business layer demands in mind, i.e. it has no use to implement all sorts of hypthetical methods that are not needed by the business layer. Of course, if it turns out handy, you can 'channel' all your database access functionality through that single method but that method should not be part of the DAO's public API.
kind regards,
JosLast edited by JosAH; 07-24-2010 at 02:38 PM.
- 07-24-2010, 02:25 PM #3
- 07-26-2010, 10:15 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
As Jos says, it's about hiding the db from the rest of the code. The code doesn't actually need to know where the data it uses is coming from, so should only have to deal with business objects...that would allow you to change the implementation of your DAO (even easier if you had it as an interface) so that it, for example, called a web service, or dealt with a file system instead.
- 07-26-2010, 01:30 PM #5
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Question about architecture
By sdmente in forum Advanced JavaReplies: 7Last Post: 07-28-2010, 01:07 PM -
3 tier application and database problem.
By mcajavaprogramer in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 07-19-2010, 11:07 AM -
three tier Desktop Application
By newmember in forum AWT / SwingReplies: 0Last Post: 07-27-2008, 03:10 PM -
Architecture Rules 2.0.1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 11-17-2007, 02:03 PM -
Architecture of Any IDE...
By vikki_pu in forum Other IDEsReplies: 5Last Post: 10-30-2007, 01:08 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks