Reputation: 1620
The following Pageable Query takes a PageRequest Class as second parameter. It seems to be the cause of the Exception.
Caused by: org.h2.jdbc.JdbcSQLException: Parameter "#2" is not set; SQL statement: ... order by message0_.id desc limit ? [90012-187]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.expression.Parameter.checkSet(Parameter.java:80)
at org.h2.command.Prepared.checkParameters(Prepared.java:164)
at org.h2.command.CommandContainer.query(CommandContainer.java:89)
at org.h2.command.Command.executeQuery(Command.java:197)
at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:108)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:82)
... 98 more
UPDATE: Tried removing the second parameter just to see if it works but it's the same error it except it now point to "#1" instead of "#2" See here
Upvotes: 1
Views: 996
Reputation: 1620
Changed parameter to take Ids instead of Symbol Class, which works.
@Query(value="select msg from Message msg left join msg.tickers ticker where ticker.symbol.id IN (:ids)")
Page<Tweet> findBySymbolIdsIn(@Param("ids") List<Long> ids, Pageable pageable);
Upvotes: 1
Reputation: 1124
Try using List<> instead of Set<>. Change it to . Also change the method name to findBySymbolsIn()
@Query(value="select msg from Message msg left join msg.tickers ticker where ticker.symbol IN (:symbols)")
Page<Tweet> findBySymbolsIn(@Param("symbols") List<Symbol> symbols, Pageable pageable);
Upvotes: 0