I am migrating an app to use Room
from normal Sqlite
and one part that I am having trouble with is that there are several queries that have an orde
In Room 1.1 there is now a RawQuery
that can be used that solves this issue
@Dao
interface RawDao {
@RawQuery
User getUserViaQuery(SupportSQLiteQuery query);
}
SimpleSQLiteQuery query = new SimpleSQLiteQuery("SELECT * FROM User WHERE id = ? LIMIT 1",
new Object[]{userId});
User user2 = rawDao.getUserViaQuery(query);
https://developer.android.com/reference/android/arch/persistence/room/RawQuery