0

Im using GenericDao with few entities and i want to make an a single interface and its implementation with this entities. I have 2 Dao's interface and its implementation that extends GenericDao and i want to combine them into one interface and its implementation.

Something like that:

Entity1Dao:

public interface Entity1Dao extends GenericDao<Entity1, String>{

public List<Entity1> getAllFromEntity1();
...
}

Entity2Dao:

public interface Entity2Dao extends GenericDao<Entity2, String>{

public List<Entity2> getAllFromEntity2();
...
}

And i want to combine them and make something like:

public interface MultyDao extends GenericDao<*I do not know what needs to be here*>{

public List<Entity1> getAllFromEntity1();

public List<Entity2> getAllFromEntity2();
}

and implement it..

Here is 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;

}

And ofc i want to use GenericDao's methods for both entities.. )

Is it possible by somehow?

cihan adil seven
  • 482
  • 1
  • 4
  • 18
  • `extends GenericDao, GenericDao{` why not just make it generic ? How about `getAllFromEntity()` and it should return all entities of type `T`. – user3719857 May 30 '16 at 13:49
  • 1
    How does GenericDao looks like? Why do you want to combine those two? – Mikey May 30 '16 at 13:52
  • Im using interface and its implementation class in jaxws webservice. So i want to group methods for all entities in one webservice. I cant find the way how to combine interfaces and its implementations with diferent entities – Артем Руденко May 30 '16 at 13:56

0 Answers0