문제

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?

도움이 되었습니까?

해결책

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top