I have implemented Generic DAO for all my bean classes. I am facing a problem in setting the entries in to the cache.
DAO.class
public abstract class DAO<T extends Serializable> extends Cache { save(Collection<T> list) { // batch process will store the list to db for(T t : list) { cache(t.getKey(), t); } } } Bean's DAO classes
public class BeanDAO1 extends DAO<Bean1> { public static set(Collection<Bean1> list) { super.save(list); } } public class BeanDAO2 extends DAO<Bean2> { public static set(Collection<Bean2> list) { super.save(list); } } Now the problem is, both Bean classes have same getter method getKey(). But in DAO class, as it is type referenced, i couldn't access the method.
Is it something i am doing wrong or I should do some other thing?