Reputation: 3994
I have a JDBI query that is as simple as it can be
@Override
@SqlQuery("SELECT COUNT(*) FROM " + TABLE_NAME + " WHERE (" + COLUMN_MODERATOR_CATEGORY_ID
+ " in (<categories>) OR " + COLUMN_EXPERT_CATEGORY_ID
+ " in (<categories>)) AND (" + COLUMN_STATUS + " <> 0)")
long getIdeasCountInCategories(@BindIn("categories") List<Long> categories);
The <> 0
fails with a syntax error at the end of input...
. It works as soon as I change it to > 0
(which also serves the purpose).
Using Java 1.8.0 and Postgres 9.6. Please let me know if any more info is needed.
Upvotes: 0
Views: 138
Reputation: 898
If you absolutely can't change the SQL query (e.g. switch operator to !=
or >
) then you need to escape <
with preceding \\
.
Upvotes: 2