What is the LIMIT clause alternative in JPQL?

前端 未结 7 673
不思量自难忘°
不思量自难忘° 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 04:18

    Hello for fetching single row and using LIMIT in jpql we can tell the jpql if it's a native query.

    ( using - nativeQuery=true )

    Below is the use

    @Query("SELECT s FROM Students s ORDER BY s.id DESC LIMIT 1", nativeQuery=true)
    Students getLastStudentDetails();
    
    0 讨论(0)
提交回复
热议问题