lsp4jakarta icon indicating copy to clipboard operation
lsp4jakarta copied to clipboard

JEE11_Data: Queries must not mix positional and named parameters. Use only one parameter style consistently.

Open archana-1924 opened this issue 1 month ago • 0 comments

Description:

A query must use either positional parameters (?1, ?2, …) or named parameters (:name, :price, …). Mixing positional and named parameters in the same query is invalid.

Examples:

Invalid example

@Query("SELECT p FROM Product p WHERE p.name = :name AND p.price < ?2") 
List<Product> findByNameAndPrice(@Param("name") String name, double price); 
// Invalid: mixes named (:name) and positional (?2) parameters 

Valid example

@Query("SELECT p FROM Product p WHERE p.name = :name AND p.price < :price") 
List<Product> findByNameAndPrice(@Param("name") String name, @Param("price") double price); 
//Valid: only named parameters 

Specification: 

https://jakarta.ee/specifications/data/1.0/jakarta-data-1.0#:~:text=Positional%20and%20named%20parameters%20must%20not%20be%20mixed%20in%20a%20single%20query

Type of language feature proposed:

Select all that apply

  • [x] diagnostic
  • [ ] quick-fix
  • [ ] snippet
  • [ ] other, please specify:

archana-1924 avatar Nov 21 '25 04:11 archana-1924