Input parameter not recognized when used with custom constructor

Description

JpaRepository:

@Query("SELECT new ReportConfig(rc.uuid, rc.accountId, rc.createDate, rc.modifiedDate, author.id, :userId, author.firstName, author.lastName, rc.title ) FROM ReportConfig rc " +
...
)
List<ReportConfig> findByAccountIdAndUserId(@Param("accountId") Long accountId, @Param("userId") Long userId );

Constructor:

public ReportConfig(
String uuid,
Long accountId,
Date createDate,
Date modifiedDate,
Long ownerId,
Long userId,
String firstName,
String lastName,
String title)
{
// other stuff
}

Exception:

Unable to locate appropriate constructor on class ... Expected arguments are: java.lang.String, long, java.util.Date, java.util.Date, long, java.lang.String, java.lang.String, java.lang.String

As you can see :userId is not recognized as Long input parameter for the constructor.

Clearly the JPQL BNF does permit passing parameters as constructor arguments.

 

Environment

None

Status

Assignee

Unassigned

Reporter

Simon Mitev

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

Priority

Major
Configure