import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
-import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Transaction;
import androidx.room.Update;
@Dao
public interface PatternHeaderDAO {
- @Insert(onConflict = OnConflictStrategy.REPLACE)
+ @Insert()
long insert(PatternHeader item);
@Update
ArrayList<PatternDetailsItem> newList = new ArrayList<>();
final PatternDetailsItem.Header header = PatternDetailsItem.createHeader();
header.setName(mDefaultPatternName);
- header.setId(1);
+ header.setId(0);
newList.add(header);
while (newList.size() < 3) {
.getPatternDAO();
PatternHeader dbHeader = modelHeader.toDBO();
if (newPattern) {
+ dbHeader.setId(null);
dbHeader.setId(mPatternId = headerDAO.insert(dbHeader));
}
else
PatternAccount dbAccount = accRowItem.toDBO(dbHeader.getId());
dbAccount.setPatternId(mPatternId);
dbAccount.setPosition(i);
- if (newPattern)
+ if (newPattern) {
+ dbAccount.setId(null);
dbAccount.setId(paDAO.insert(dbAccount));
+ }
else
paDAO.update(dbAccount);