Hi,
I am trying to create a Named Query for an object that returns the max of an integer field, but when i create one using DSL it gives me a cannot cast error.
So…
-I have a Member object with a memberno field.
-I createws a named query using DSL and but when had no input and 1 integer output.
and the named query is
Select max(myMember.memberno) from Member myMember
When I save the DAO of the member object i get an error here:
@Transactional
public Integer getMaxMemberNo(int startResult, int maxRows) throws DataAccessException {
try {
return executeQueryByNameSingleResult("getMaxMemberNo");
} catch (NoResultException nre) {
return null;
}
}
on
return executeQueryByNameSingleResult("getMaxMemberNo");
the error “Type mismatch: cannot convert from Member to Integer” shows.
Please Help.