DAO
Hi friends.
I want use DAO for create a Swing application, that acess to PostgreSQL.
I want to retrieve a list of objects ( for example: clients), How is the best implementation?
Client[] clients = ClientDAO.getClients();
or
javax.sql.RowSet clients = ClientDAO.getClients();
I'll use result ('clients') to show in a JTable;
Another question, if i only want a chunk of clients (first 10, after another 10, ..), how can i implement this?.
Last question, Is there some utility to facilitate the work with DAO?
Thank you, very much.
[594 byte] By [
TechGSisa] at [2007-11-27 9:09:16]

# 2
> Never, ever pass your result set out of your DAO.
> The first is what you should do.
Exactly. The point of the pattern is to shield client code from details of the datastore, such as the fact that there's a JDBC resultset involved. Whenever considering adding a layer to your app, first ask what actual value it will add, don't just do it because it seems the done thing
# 3
> Another question, if i only want a chunk of clients
> (first 10, after another 10, ..), how can i implement
> this?.
>
Ideally using a sequential primary key.
Other than that the solutions become harder and are data dependent.
> Last question, Is there some utility to facilitate
> the work with DAO?
Code generation is how I do it.