public class ProductDTO {
public ProductDTO(final String name, final Boolean isBrandNew) { ... }
}
QProduct product = QProduct.product
Expression<Boolean> isBrandNew = new CaseBuilder()
.when(product.creaDate.eq(product.modDate)).then(Boolean.TRUE)
.otherwise(Boolean.FALSE)
.as("brandNewProduct")
JPAQuery query = new JPAQuery (this.em);
query.from(product)
.where(product.name.eq("blah"))
.listDistinct(ConstructorExpression.create(ProductDTO
, product.name
, isBrandNew))
什麼是對CaseBuilder將包括在我的查詢的最終SELECT語句「brandNewProduct」欄的正確設置JPA例如用於ConstructorExpression和CaseBuilder?QueryDSL:在QueryDSL 2.9.0
目前,所有我從休眠狀態得到的是異常
org.hibernate.hql.internal.ast.tree.ParameterNode cannot be cast to
org.hibernate.hql.internal.ast.tree.SelectExpression
org.hibernate.hql.internal.ast.tree.CaseNode.getFirstThenNode(CaseNode.java:43)