Hi I have an issue using Criteria API and mapper class. I get an exception
that Criteria can not be cast to Part. Using delta spike version 1.4.1
The issue is that in QueryBuilder class in method isUnmappableResult you
should have check if it's an instance of Criteria, and evaluate if you need
some more classes.
Here is the method I'm talking about:
private boolean isUnmappableResult(Object result) {
return result instanceof QueryResult ||
result instanceof Query;
}
Here is an example code:
@Repository(forEntity = Part.class )
@MappingConfig(PartDtoMapper.class)
public abstract class PartRepository implements CriteriaSupport<Part>,
EntityRepository <PartDto, Integer> {
public List<Part> doSearch(PartSearchFilter filter){
Criteria<Part, Part> criteria = criteria().eq(Part_.partNumber,
filter.getPartNumber()); <-- Fails here
return criteria.getResultList();
}
}
--
View this message in context:
http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/QueryCriteria-is-being-mapped-with-Mapper-tp4661019.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at
Nabble.com.