Skip to content

$expand with $count fails when having a join table issue still exists on version 2.3.0(opened earlier as #376 and closed as fixed) #431

Closed
@dbhandari555

Description

@dbhandari555

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().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions