Optional query parameters for Android Room
I have the following DAO with a query: @Dao public interface BaseballCardDao { @Query( "SELECT * FROM baseball_cards " + "WHERE brand LIKE :brand " + " AND year = :year " + " AND number LIKE :number " + " AND player_name LIKE :playerName " + " AND team LIKE :team" ) LiveData<List<BaseballCard>> getBaseballCards( String brand, int year, String number, String playerName, String team ); } The String parameters are "optional" in the sense that I can pass "%%" to match all rows due to the LIKE operator. But I cannot do this with year since it is an int . One solution is to add two different @Query