greendao insert data UNIQUE constraint failed: PURCHASE_ORDER_TABLE._id (code 1555)

On the face of it, I encountered this problem recently when the project was about to go live
In Greendao’s database table, the ID field is unique due to the insertion of data with duplicate IDS
However, our business logic is that if the database is emptied and the data is inserted, it is theoretically impossible to have duplicate ids

DaoUtils.getDaoSession().getPurchaseOrderTableDao().insertInTx(mPurSkuList);

The number of lines of code goes to this location
The first thing that comes to mind is that the data table may not be completely cleaned up, but after debugging, it is indeed completely cleaned up
Continue debugging and find problems


Read More: