Skip to content

Native query validation does not accept a numbered parameter as limit argument #1938

Closed

Description

@elmuerte

Describe the bug

The SQL query parser does not accept using a parameters for a limit.

MySQL: no viable alternative at input 'select * from user_history h where h.user_id = ?1 order by h.timestamp desc limit ?' [SQL_SYNTAX]

Using 5.2.0.202606090740 in Eclipse.

To Reproduce

Define a native query in a Spring Data JpaRepository.

@Query(value = "select * from user_history h where h.user_id = ?1 order by h.timestamp desc limit ?2", nativeQuery = true)
List<UserHistory> findUserHistory(String userId, int limit);

Sample

See above

Activity

  1. elmuerte commented on Jul 17, 2026

    @elmuerte
    Author

    Named parameters are not accepted either.

  2. self-assigned this
    on Jul 17, 2026
  3. added this to the 5.3.0.RELEASE milestone on Jul 17, 2026
  4. added
    for: eclipse
    for: vscode
    and removed on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetheme: spring-data-supporttheme: validationtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions