Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InsertMany with primaryKey set to auto #184

Open
Skuallpa opened this issue Apr 17, 2020 · 0 comments
Open

InsertMany with primaryKey set to auto #184

Skuallpa opened this issue Apr 17, 2020 · 0 comments

Comments

@Skuallpa
Copy link

Hello,

My model as the primary key set auto

class MyModel {
 @PrimaryKey(auto: true)
 int id;

 // .. other fields
}

When I'm trying to insert many of those object at once using insertMany, I got the error that the table has one more column that the values supplied:

await _myModelBean.insertMany(myModels);

table myTable has 3 columns but 2 values were supplied

This works if I insert using a loop like below, but this is probably much heavier in term of performance:

for (final myModel in myModels) {
    await _myModelBean.insert(myModel);
}

How to use "insertMany" with the primary key set to auto generation?

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant