JDBCTemplate query params in kotlin

Hi, how are JDBCTempalte params passed in kotlin?

In Java (with which I’m familiar with) it’s done such as:

String query = "SELECT * FROM answers WHERE category=? AND NOT id = ? ORDER BY Random() LIMIT ?"; List<Answer> results = template.query(query, new AnswerMapper(), new Object[] { category, excludeId, n }); 

I’m pretty new to Kotlin so I have no idea how to change the new Object[] { category, excludeId, n }); part to the equivalent in Kotlin. I tried using String templates but they are of course considered unsafe to use in sql, so params are the way to go.

submitted by /u/Glittering-Spite234
[link] [comments]