In attempting to implement a base generic CRUD DAO, I have run into what seems a bit of an antipattern

GenericDao

```
public interface GenericDao<T, PK extends Serializable> {

  T findOne(final PK id);

  List<T> findAll();

  PK create(final T entity);

  void update(final T entity);

  void delete(final T entity);

  void deleteById(final PK id);

}

```

GenericDaoHibernateImpl

```
public abstract class GenericDaoHibernateImpl<T, PK extends Serializable> implements    GenericDao<T, PK> {

  @Autowired
  private SessionFactory sessionFactory;
  private Class<T> clazz;

  public GenericDaoHibernateImpl(Class<T> clazzToSet) {
      this.clazz = clazzToSet;
  }

  protected final Session getCurrentSession() {
    return sessionFactory.getCurrentSession();
  }

  @Override
  public T findOne(PK id) {
    return (T) getCurrentSession().get(clazz, id);
  }

  @Override
  public List<T> findAll() {
    return getCurrentSession().createQuery("from " + clazz.getName()).list();
  }

  @Override
  public PK create(T entity) {
    return (PK) getCurrentSession().save(entity);
  }

  @Override
  public void update(T entity) {
    getCurrentSession().update(entity);
  }

  @Override
  public void delete(T entity) {
    getCurrentSession().delete(entity);
  }

  @Override
  public void deleteById(PK id) {
    final T entity = findOne(id);
    delete(entity);
  }
}

```

CustomerDao 

```
public interface CustomerDao extends GenericDao<Customer, Long> {

  public Customer findByUsername(String username);

}

```

CustomerDaoHibernateImpl 

```
public class CustomerDaoHibernateImpl extends GenericDaoHibernateImpl<Customer, Long> implements CustomerDao {

  public CustomerDaoHibernateImpl() {
    super(Customer.class);
  }

  public Customer findByUsername(String username);
    Criteria criteria =  getCurrentSession().createCriteria(Customer.class);
    criteria.add(Restrictions.eq("username", username));
    return criteria.list();
  }

}

```

The issue I am refering to, is that in our domain specific DAO implementations, it is like we are satisfying/implementing GenericDao twice. Once in GenericDaoHibernateImpl, and then again in our domain DAO interface, ie CustomerDao. Here we must specify in the declaration, to use Customer and Long.
We then implement CustomerDaoHibernateImpl, and again we must declare Customer and Long.

Am I doing something wrong, because it just doesnt seem like the correct way to go about it.

Thanks