Solved

DAO method return types

Posted on 2011-09-10
4
399 Views
Last Modified: 2012-05-12
I would like to know about DAO layer. Waht are the return types of those methods. Where, how, why we use this layer. Advantage, disadvantage. I am not clear on this concept. thank in advance
0
Comment
Question by:gudii9
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
evedder earned 250 total points
Comment Utility
the DAO layer is conceptual you have to define your classes so the type those method returns depends on you, but the idea is to have these classes that act like a pass through your application and the data i mean they are the key to get your info, so you can separate your application logic from the data access. This data can be in a database, text files, etc.
0
 
LVL 3

Expert Comment

by:evedder
Comment Utility
0
 
LVL 1

Assisted Solution

by:vakorde
vakorde earned 250 total points
Comment Utility
The concept of layer came into picture to separate the complexity of a particular area. The change in a layer should impact only the adjoining layers.  
If we are talking about DAO, this is built to separate the Database access complexity. There are many different types of databases like CSV file, XML file, Relational, etc. Each of these will have their own mechanism to extract required data. The DAO layer makes sure that even if we changes the database it should not impact the adjoining layer (generally business layer). We just need to do the changes in DAO layer.
To achieve this we must use the POJO objects to communicate data between layers.
To answer your question, the return type should be a POJO. It can be Map, List, String basis on your requirement but it must be a Plain Old Java Object (POJO).
0
 
LVL 7

Author Comment

by:gudii9
Comment Utility
>>>To answer your question, the return type should be a POJO

can we return POJO. How to return a POJO. Can you please point me to simple example
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now