The task that I should have done is already set, but a certain question arises in my mind.
I defined the following interface:
package dao;
import java.sql.SQLException;
public interface IDao<T> {
public void fetch(int id);
public void save() throws SQLException;
public void delete() throws SQLException;
}
The goal is that all pojo that are represented as database entities implement these methods, so the pojo user knows how to handle instances according to the pattern. I used this approach from Backbone (Javascript).
However, there are other methods that I liked to impose as cool methods (static) on the Pojo class itself. The most obvious methods are things like:
List<Person> list = Person.fetchAll();
List<Person> list = Person.fetchAll(offset, limit);
int i = Person.countAll();
...
, , , . , , , ( ); , , .
?