【发布时间】:2014-02-19 15:01:45
【问题描述】:
我目前正在编写一份报告,其中一个字段需要 group_concat。
CriteriaQuery<GameDetailsDto> criteriaQuery = criteriaBuilder
.createQuery(GameDetailsDto.class);
Root<BetDetails> betDetails = criteriaQuery.from(BetDetails.class);
Expression<String> betSelection = betDetails.get("winningOutcome");
criteriaQuery.multiselect(
// other fields to select
criteriaBuilder.function("group_concat", String.class, betSelection),
// other fields to select
);
//predicate, where clause and other filters
TypedQuery<GameDetailsDto> typedQuery = entityManager.createQuery(criteriaQuery);
这会在该行引发空指针异常:
TypedQuery<GameDetailsDto> typedQuery = entityManager.createQuery(criteriaQuery);
我是不是错误地使用了criteriaBuilder的函数方法?
文件说:
function(String name, Class<T> type, Expression<?>... args);
【问题讨论】:
-
包括空指针的堆栈跟踪。
标签: jpa group-concat