Skip to content
Advertisement

How would I write SELECT TOP 25 sql query in Spring data repository

A quick question, because I am sure this is something silly. I have the following query which I can execute in NetBeans sql command window:

My goal is to put put it in my ArcustRepository class:

public interface ArcustRepository extends JpaRepository {

However, that findBytop query doesn’t seem to work and when I start my service with tomcat7 returns this:

Advertisement

Answer

# Pure SQL

Use “Limit”

Note: JPA supports creation of the Native query by using method createNativeQuery() OR by using the annotation @NamedNativeQuery JPA Native Query select and cast object object


# JPA

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement