What is DAO factory pattern?

DAO stands for “Data Access Object”. It’s an interface-based class that handles all your CRUD operations with a relational database for a particular object. Here’s an example that uses generics:

package persistence;

public interface GenericDao<K extends Serializable, T> 
{
    public T find(K id);
    public List<T> find();
    public K save(T value);
    public void update(T value);
    public void delete(T value);
}

Think of a factory as a “virtual constructor”: its creation method returns an interface type, but you can ask it to create any number of different implementations as needed.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)