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
Solved

DAO method return types

Posted on 2011-09-10
4
428 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
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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet  URL Rewriting 1 42
Opening PDF on button click and fill new document 2 47
How  can  i  resolve  HTTP Status 404 -? 8 42
learn programming 8 32
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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 one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.

808 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