dao, dto need explanation

hi,when i write java classes , people suggest that classify the clasess into dao, dto.. can any one give more details on these terms...i am sorry if it boar this question to all...thanks in advance
[225 byte] By [loguKKa] at [2007-11-26 13:41:10]
# 1
DAO == Data Access Object (aka Repository). This is where your persistence code belongs. Start with an interface and write an implementation for it.DTO == Data Transfer Object. Used to transfer complex objects from one layer (e.g., persistence) to another (e.g., view)%
duffymoa at 2007-7-7 22:39:02 > top of Java-index,Java Essentials,New To Java...
# 2
thanks ..but if there is any example it would be nice to understand...
loguKKa at 2007-7-7 22:39:02 > top of Java-index,Java Essentials,New To Java...
# 3

Is Google not installed on your machine? Try searching for "Java DAO".

But since it's clear that you need some spoon feeding, here's a simple one:

public class Person implements Serializable

{

private Long id;

private String firstName;

private String lastName;

// ctors, getters, setters, equals, hashCode, other methods go here.

}

public interface PersonDao

{

Person find(Long id);

List<Person> findAll();

List<Person> findByLastName(String lastName);

void save(Person p);

void update(Person p);

void delete(Person p);

}

public class CompanyDto implements Serializable

{

private List<Person> employees;

// ctors, getters, setters, equals, hashCode, other methods go here.

}

That's the idea.

%

duffymoa at 2007-7-7 22:39:02 > top of Java-index,Java Essentials,New To Java...
# 4
thanks duffymo.., i am clear now...
loguKKa at 2007-7-7 22:39:02 > top of Java-index,Java Essentials,New To Java...