What is the LIMIT clause alternative in JPQL?

前端 未结 7 689
不思量自难忘°
不思量自难忘° 2020-12-13 03:26

I\'m working with PostgreSQL query implementing in JPQL.

This is a sample native psql query which works fine,

SELECT * FROM students ORDER BY id DESC         


        
7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 03:59

    You can use something like this:

     @Repository
     public interface ICustomerMasterRepository extends CrudRepository 
     {
        @Query(value = "SELECT max(c.customer_id) FROM CustomerMaster c ")
        public String getMaxId();
     }
    

提交回复
热议问题