Solved

DAO method return types

Posted on 2011-09-10
4
441 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
evedder earned 250 total points
ID: 36517886
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
ID: 36517890
0
 
LVL 1

Assisted Solution

by:vakorde
vakorde earned 250 total points
ID: 36520817
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
ID: 36636131
>>>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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

738 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