Ive seen allot of usages of generic dao over the internet. you gotta love it:
public interface GenericDao <T, PK extends Serializable> {}
public class GenericDaoHibernateImpl <T, PK extends Serializable>
implements GenericDao<T, PK>
a new class appeared? no problem:
public interface NewClassDao extends GenericDao<NewClass, Long>
and we're all set.
now, how bad is it if i go "full-generic" and do something like:
public interface FullGenericDao
public class FullGenericDaoHibernateImpl
now i can only use one DAO (of Object with casting!)
a new class appeared again? no problem:
NewClassApperedAgain newClassAppeared = (NewClassApperedAgain) FullGenericDao.getItemById(20, NewClassApperedAgain.class);
two questions comes to mind:
1) Is it even possible to go "full-generic" and actually create such a DAO? I mean i dont see why not passing for every method of the dao the className and just do the casting neccessary? save(object,className); delete(object,className); etc..
2) What are the Cons (i'm sure there are) of such practice?
thanks!