Module jakarta.data

Annotation Interface Param


@Retention(RUNTIME) @Target(PARAMETER) public @interface Param

Annotates a parameter of a repository method to bind it to a named parameter of a Query.

For example,

 @Repository
 public interface Products extends BasicRepository<Product, String> {

     @Query("WHERE length * width * height <= :maxVolume")
     Page<Product> freeShippingEligible(@Param("maxVolume") float volumeLimit,
                                        PageRequest<?> pageRequest);

     ...
 }
 

The Param annotation is unnecessary when the method parameter name matches the query language named parameter name and the application is compiled with the -parameters compiler option making parameter names available at runtime.

See Also: