Closed greenrobot closed 2 years ago
The flower has faded three times .
It's going to bloom again this year .
Any updates?
I have migrated from greendao to objectBox, and stuck in this @unique. Any update please? Should I revert back my whole project again? Or I have to insert data iteratively?
When my only value is a string, I can only insert data iteratively at present. I don't think it's a good way. Is there a better way?
You may want to try the new @Unique(onConflict = ConflictStrategy.REPLACE)
of the 2.9.2-RC preview release.
Currently there can only be a single property annotated with this.
You may want to try the new
@Unique(onConflict = ConflictStrategy.REPLACE)
of the 2.9.2-RC preview release.Currently there can only be a single property annotated with this.
Yes , Yes !!!!!
You may want to try the new
@Unique(onConflict = ConflictStrategy.REPLACE)
of the 2.9.2-RC preview release.Currently there can only be a single property annotated with this.
Thank you so much for this! :) So far with my testing it seems to be working great and my app is running noticeably smoother than the old hack I had!
This is now available with the 3.0.1
release.
@greenrobot don't wanna be the party pooper here, but what happened to onConflict=IGNORE
along the way ?
@RobbWatershed Got mislead by the title and closed this. But yes, the later proposal has more options like IGNORE
: https://github.com/objectbox/objectbox-java/issues/509#issuecomment-425055199
Re-opening this for now, I guess. But maybe this should get its own issue, this one has been getting rather long.
We really should move the remaining option(s) to a new issue to start from a clean slate... Note though that other options are not "sync friendly"...
Thanks for the quick reply guys. Shall I create a new issue then ? I don't mind at all
Closing this then. For more conflict strategy options vote and comment on #1023.
The same behavior is happening on Dart, does the new ConflictStrategy.replace available for dart or just for java, cause I'm stuck with the same problem. I'm trying to accomplish on unique key conflict, I don't want to remove the old object and insert a new one, I want the same object to be updated. @greenrobot-team
Right now,
@Unique
throws an exception if there's a violation.We could also offer to replace old entities with newer ones, e.g. by doing a
@Unique(replaceOnConflict = true)
.Keep in mind: If there are multiple unique properties, on entity might replace several others.