All my repositories are extending commonService Repository which in return are extending JpaRepository and JpaSpecification
public interface CommonReadRepository<T>
extends JpaRepository<T, Long>, JpaSpecificationExecutor<T> {
i want to define native Sql query in CommonReadRepository like : Mysql:select * from table limit 1,20;
@Query(value = "select * from ?1 limit ?2,?3", nativeQuery = true)
List<?> customFindQuery(String tableName,int offset,int limit);
but i recieve SqlGrammerException and unfortunately , i did not find much about syntax in documentation.
i know if i can define the queries in repositories then i know the table name but is it possible to make it generic ?
Thanks