Skip to content

Fix it so count queries work properly for select new com.example.Dto(...) situations #1869

Closed
@spring-projects-issues

Description

@spring-projects-issues

Phil Webb opened DATAJPA-1598 and commented

Originally raised in spring-projects/spring-boot#17961 but this looks like a Spring Data issue. I'll ask the OP for more info.

After upgrading spring boot to 2.1.7 from 2.1.6, running application are failing due to the issue:

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: count near line 1, column 8 [select count(new map(model as levelTingkat)) from com.jasamedika.medifirst2000.entity.LevelTingkat model left join model.id id  where id.kdProfile=:kdProfile  and model.statusEnabled=true  ]
public interface  interface LevelTingkatDao extends CrudRepository.
Query : "select new map(model as levelTingkat) " 
            + " from LevelTingkat model left join model.id id "
            + " where id.kdProfile=:kdProfile "
            + " and model.statusEnabled=true  "
method: Page<Map<String, Object>> findAllList(
            @Param("kdProfile") Integer kdProfile,
            Pageable pageable);

In new CrudRepository, it seem, has adding "count" to Query HQL, because present of Pageable parameter.


0 votes, 5 watchers

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions