我使用几个实体的GenericDao,我想创建一个单独的接口及其实现与此实体。我有2个Dao的接口,它的实现扩展了GenericDao,我希望将它们组合成一个接口及其实现。
类似的东西:
Entity1Dao:
public interface Entity1Dao extends GenericDao<Entity1, String>{
public List<Entity1> getAllFromEntity1();
...
}
Entity2Dao:
public interface Entity2Dao extends GenericDao<Entity2, String>{
public List<Entity2> getAllFromEntity2();
...
}
我希望将它们结合起来并制作类似的东西:
public interface MultyDao extends GenericDao<*I do not know what needs to be here*>{
public List<Entity1> getAllFromEntity1();
public List<Entity2> getAllFromEntity2();
}
并实施它..
这是GenericDao:
package org.dao.nci.person;
import java.io.Serializable;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebService;
import org.springframework.transaction.annotation.Transactional;
public interface GenericDao<E,K> {
@WebMethod(exclude = true)
public String add(List<E> entities) throws Exception;
@WebMethod(exclude = true)
public String saveOrUpdate(List<E> entity) throws Exception;
@WebMethod(exclude = true)
public String update(E entity, String whereClause) ;
@WebMethod(exclude = true)
public String remove(E entity) throws Exception;
@WebMethod(exclude = true)
public String removeWhereClause(String whereClause) throws Exception;
@WebMethod(exclude = true)
public E find(K key);
@WebMethod(exclude = true)
public List <E> get(String whereClause) throws Exception ;
public String addTest(List<E> entities) throws Exception;
}
而且我想为两个实体使用GenericDao的方法..)
有可能以某种方式吗?