1

I have query as such :

@Query("select a from Ability a where a.eventLogic = ?1 AND a.abilitySetId = ?2 ORDER BY    RAND() LIMIT ?3")

BUt i get an error:

Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: LIMIT near line 1, column 117

How can i programmatically put in the limit number?

user1555190
  • 2,325
  • 7
  • 39
  • 67

2 Answers2

1

spring data jpa, has documentation, that states how to solve this using some paging. Thats what i used

user1555190
  • 2,325
  • 7
  • 39
  • 67
0

I had a similar issue and adding an explicit ASC clause solved it.

Stephane
  • 10,017
  • 21
  • 96
  • 152