Pregunta

I need to use Ebean to run native SQL queries like this: http://www.avaje.org/static/javadoc/pub/com/avaje/ebean/SqlQuery.html

But how can I express 'not in' syntax to set parameter?

¿Fue útil?

Solución

not in should work fine directly in the SqlQuery.

select col1, col2 from tbl where col3 not in ( :val1, :val2 )


sqlQuery.setParameter("val1", 7);
sqlQuery.setParameter("val2", 42);

You can also pass a list as a parameter:

select col1, col2 from tbl where col3 not in ( :valList )


sqlQuery.setParameter("valList", listOfValues);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top