if change OPERATION_TYPE to OperationType, and jpql like this : "select new DebtBalance(d.productType, sum(case when d.operationType = com.geewit.demo.business.Constants$OperationType.INCREASE then d.amount when d.operationType = com.geewit.demo.business.Constants$OperationType.DECREASE then -d.amount end)) from DebtBalanceDetail d group by d.productType"; IT WORKS! There is some problems in
class org.hibernate.internal.util.ReflectHelper
private static final Pattern JAVA_CONSTANT_PATTERN = Pattern.compile(
"[a-z]+\\.([A-Z]{1}[a-z]+)+\\$?([A-Z]{1}[a-z]+)*\\.[A-Z_\\$]+" );
org.hibernate.internal.util.ReflectHelper.getConstantValue(String name, SessionFactoryImplementor factory) {
...
if ( conventionalJavaConstants && !JAVA_CONSTANT_PATTERN.matcher( name ).find() ) {
return null;
}
...
}
It can NOT match enum or class like "OPERATION_TYPE" |