Description
odata-jpa version : 2.3.0
Issue summary:
When the criteria builder supplied is other than ProcessorCriteriaBuilder(For example: Hibernate's SqmCriteriaNodeBuilder), JPAExpandJoinCountQuery's count() method gets invoked. To start with, it fails with NPE when constructing from clause because of target not being set in JPAAbstractJoinQuery. If you get past that by explicitly setting the target to root, buildExpandJoinPath fails with error when getting columns list since there is only one column supplied.
Technical details:
First error: NPE
private void createCountFrom(CriteriaQuery countQuery) throws ODataApplicationException {
HashMap<String, From> joinTables = new HashMap();
this.createFromClauseRoot(countQuery, joinTables);
this.createFromClauseNavigationJoins(joinTables);
this.lastInfo.setFromClause(this.target);
}
createFromClauseRoot does not set the target in JPAAbstractJoinQuery causing NPE when executing createFromClauseNavigationJoins
Once fixed,
this.buildExpandJoinPath(this.target); results in "com.sap.olingo.jpa.processor.core.exception.ODataJPAQueryException: ON condition right attribute is null / not found." at this.association.getJoinColumnsList().