I am using room persistent library in my project. I am trying to use 'like' clause in query but I am not able to use. I have tried both compile time (Query) and run time query (Raw Query ). Neither it's giving any kind of exception nor it's giving any output.
I have tried following ways but none of them worked :-
Compile time Query -
@Query("select * from recipe where type_of_diet like '%vegetarian%' ") public abstract DataSource.Factory<Integer, RecipeListPojo> getRecipeListVeg();
RawQuery -
@RawQuery(observedEntities = RecipeListPojo.class) public abstract DataSource.Factory<Integer,RecipeListPojo> getAllRecipesList(SupportSQLiteQuery sqLiteQuery); String query="select * from recipe where type_of_diet like '%vegetarian%' "; SimpleSQLiteQuery simpleSQLiteQuery = new SimpleSQLiteQuery(query); recipeDao.getAllRecipesList(simpleSQLiteQuery);
compileSdkVersion 27
Library used - implementation "android.arch.persistence.room:runtime:1.1.0-beta3" annotationProcessor "android.arch.persistence.room:compiler:1.1.0-beta3"
Kindly let me know how can I run these type of queries.