ORMLite with CursorAdapter in Android

前端 未结 3 1797
花落未央
花落未央 2020-12-09 18:35

I am modifying my Android app to work with ORMLite, and it currently uses a number of CursorAdapters, which I quite want to keep in an attempt to minimise coding.

I\

3条回答
  •  一生所求
    2020-12-09 19:30

    It turns out I did need a raw SQL query with ORMLite after all as I needed to do a Left Join, (i.e. not as a result of having to rename the id column in a query, that is not necessary as per Gray's answer above)

    The way I did it is below:

    public class DatabaseHelper extends OrmLiteSqliteOpenHelper{
       public void myRawQueryMethod() {
            SQLiteDatabase database = this.getReadableDatabase();
            String SqlQuery = "Write raw SQL query here"; 
            Cursor cursor = database.rawQuery(SqlQuery, null);
        }
    }
    

    Thanks for advice

提交回复
热议问题