1

我有一个这样的 SQL 语句:

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 ; 

返回:

generatedresult  |   count    
------------------+------------
                  | 3743040708
 Phrase1          |    1332377
 Phrase2          |          0
 Phrase3          |          0

当我为此查询编写结果集映射时,如下所示:

@Entity
@Stateless
@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")
        })})
})

并在另一个类中使用它我得到了空结果。有人对这个问题有任何意见吗?

4

0 回答 0