title: How would I write SELECT TOP 25 sql query in Spring data repository
body: <p>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:</p>
  
  <pre><code>SELECT TOP 25 * FROM ARCUST_BIG  WHERE arcustno&lt;='300000' ORDER BY arcustno DESC
  </code></pre>
  
  <p>My goal is to put put it in my ArcustRepository class:</p>
  
  <p>public interface ArcustRepository extends JpaRepository {</p>
  
  <pre><code>Arcust findByPrimaryKey(String id);
  
  @Query("SELECT COUNT(a) FROM Arcust a")
  Long countAll();
  
  @Query("SELECT TOP 25 a FROM Arcust a WHERE a.arcustno&lt;='?1' ORDER BY a.arcustno DESC")
  List&lt;Arcust&gt; findByTop(String arcustno);
  }
  </code></pre>
  
  <p>However, that findBytop query doesn't seem to work and when I start my service with tomcat7 returns this:</p>
  
  <pre><code>2013-08-15 08:15:20 ERROR ContextLoader:319 - Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arcustService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.waudware.pics.repository.ArcustRepository com.waudware.pics.service.ArcustService.arcustRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arcustRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.waudware.pics.repository.ArcustRepository.findByTop(java.lang.String)!
  Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.waudware.pics.repository.ArcustRepository.findByTop(java.lang.String)!
  Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: 25 near line 1, column 12 [SELECT TOP 25 a FROM com.waudware.pics.domain.Arcust a WHERE a.arcustno&lt;='?1' ORDER BY a.arcustno DESC]
  </code></pre>