java.lang.Object; cannot be cast to model class: error in Spring Boot
Option 1) Make sure the RoomCPCMapping
is a projection interface:
public interface RoomCPCMappingResult {
String getNCCPCode();
String getNPercent();
...
}
Option 2) Use the result class legacy option:
SELECT new com.my.package.RoomCPCMappingResult(u.nCCPCode,u.nPercent)
FROM RoomCPCMapping u JOIN u.clientCPC ur
where u.nRoomAllocationId=:nRoomAllocationId
just make sure you have an adequate constructor present there.