Resultset Mapping Returns null, SQL statement doesn't
I have an SQL statement like this:
SELECT generatedresult,sum(size) as count FROM table1_detail AS w WHERE date > '2011.06.01' AND w.l_date < '2011.06.02' GROUP BY category ORDER BY count desc ;
Which returns:
generatedresult | count
------------------+------------
| 3743040708
Phrase1 | 1332377
Phrase2 | 0
Phrase3 | 0
When I write a resultset mapping for this query like this:
@Entity
@S开发者_运维技巧tateless
@Cache(type = CacheType.NONE, alwaysRefresh=true, shared=false, expiry=1, size=0)
@Cacheable(false)
@SqlResultSetMappings({
@SqlResultSetMapping(name = "ResultMapping",
entities = {
@EntityResult(entityClass = ResultMap.class,
fields = {
@FieldResult(name = "generatedresult", column = "generatedresult"),
@FieldResult(name = "count", column = "count")
})})
})
and use it in another class I got null result. Does anyone having any opinion about this issue?
精彩评论