Solved

DAO method return types

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java: The Public Class Main 4 45
ejb mdb examples 1 19
intellij error 2 27
Setup GlassFish 4 34
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

756 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