我有以下课程:
public class CategoryRepository<T> implements IRepository<T> {
String databaseUrl = "jdbc:sqlite://D://ForumDatabase10.db";
JdbcConnectionSource connectionSource = new JdbcConnectionSource(
databaseUrl);
Dao<T, String> genericDAO = DaoManager.createDao(
connectionSource,T);
@Override
public T get(String id) {
// TODO Auto-generated method stub
return null;
}
@Override
public Set<T> getAll() {
// TODO Auto-generated method stub
return null;
}
@Override
public void persist(T entity) {
genericDAO.create(entity);
}
@Override
public void remove(T entity) {
// TODO Auto-generated method stub
}
问题是我在此行收到编译错误
Dao<T, String> genericDAO = DaoManager.createDao(
connectionSource,T);
我想在createDAO方法中传递泛型作为参数,但我不知道如何。 有人可以帮帮我吗?