The following query fails when I use createQuery
select MAX(kcc.order) From KPIConfiguration kcc join EnumerationValue ev on kcc.level = ev.enumerationValueId joi