Search code examples
jpqlopenjpa

OpenJPA query validation error


I'm running the following query:

SELECT new com.acme.Rooms.RoomStatistics(r.floor.floorId ,SUM(r.roomCapacity), COUNT(DISTINCT r.roomType.roomTypeId), COUNT(r.roomId)) FROM Room r where r.disabled = 0 group by r.floor.floorId

My RoomStatistics constructor's signature is

(int, long, long, long)

I've noted the similar questions (where COUNT(AppleTree) should be replaced with COUNT(AppleTree.id)). But it looks a bit different.

I have the following error in markers view:

No constructors can be found that match the argument types. 

What's the reason of this error? Is there a way I can debug it?


Solution

  • I've disabled JPA validation. It compiles good and runs as expected without the validation. Sort of workaround, but I was unable to find better solution.

    How to disable JPA validation