QueryUnique.java:33: type parameters of <R>R cannot be determined; no unique maximal instance exists for type variable R with upper bounds E,java.lang.Object
obj = ((Dao) repository).uniqueResult(detached);
QueryUnique.java:43: type parameters of <R>R cannot be determined; no unique maximal instance exists for type variable R with upper bounds E,java.lang.Object
obj= ((Dao) repository).find(detached, startPosition);
2 errors
\nbproject\build-impl.xml:413: The following error occurred while executing this line:
\nbproject\build-impl.xml:199: Compile failed; see the compiler error output for details.
FALHA NA CONSTRUÇÃO (tempo total: 1 segundo)
<j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
Veja os códigos das classes envolvidas nesses erro:
public class QueryUnique<E> implements Query<E> {
private DetachedCriteria detached =null;
public QueryUnique(DetachedCriteria dc) {
detached=dc;
}
public E queryOn(Repository repository) {
E obj = null;
try {
obj = ((Dao) repository).uniqueResult(detached);
} catch (RepositoryException ex) {
Logger.getLogger(QueryUnique.class.getName()).log(Level.SEVERE, null, ex);
}
return obj;
}
public E queryOn(Repository repository, Integer startPosition) {
E obj = null;
try {
obj= ((Dao) repository).find(detached, startPosition);
} catch (RepositoryException ex) {
Logger.getLogger(QueryUnique.class.getName()).log(Level.SEVERE, null, ex);
}
return obj;
}
}
e a classe Dao com o método uniqueresult
public <R> R uniqueResult(DetachedCriteria detached) throws RepositoryException {
Session hibernateSession = (Session) this.manager.getDelegate();
return (R) detached.getExecutableCriteria(hibernateSession).uniqueResult();
}
Pode ser algum problema com a implementação desse método, lembrando que utilizando o método não gera nenhum erro.
O que poderia ser?