Reputation: 52484
I am getting this compile error when I try this query.
INSERT query type is not supported yet. You can use:SELECT, DELETE, UPDATE
@Query("INSERT INTO table SELECT name, etc from temp_table;")
void insertIntoTable();
Is there any other way to do a batch insert?
Upvotes: 1
Views: 810
Reputation: 52484
I was able to do it using RawQuery:
public void addRecordsFromTempTable() {
mDatabase.rawDao().insertRecords(new SimpleSQLiteQuery("INSERT INTO my_table (name, etc) SELECT name, et from temp_table;"));
}
Raw query file:
@Dao
public interface RawDao {
@RawQuery()
boolean insertRecords(SupportSQLiteQuery query);
Upvotes: 2