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
Unique properties #20
Comments
Will revisit shortly after 1.0 |
Would be great. I'm getting user ids from backend as Strings and for now I have to check if user exists manually. |
Any updates on this feature? |
Any news? |
To plan this a bit better, we have some questions (the more answers from different people the better...):
There are some design decisions depending on that. |
@Unique(caseSensitive = true, starsWith = false)
public String title |
|
As for me:
|
1-) I think it can solve most my problems for sure, but in some rare cases it may be a problem. |
I agree with @DJafari .Although i do not know how it would impact the designs ,it would be nice to have that kind of freedom to choose. |
|
Can I just confirm, that currently, if I have a Box with a String field that I would like to use as the unique ID, in order to do insert or update statements, I'll need to do a quick query first to see if the row exists? |
@wheelerruss yep, I didn't found any other way. That's why if I have any relation I have to check and create every entity by myself because when objectbox do it I have a lot of duplicates. |
Yeah that makes sense. But fingers crossed this isn't too far away from being finished :D |
Any news with this issue? |
50% done. We're using a new kind of index (hash indexes) for this. |
Very looking forward to the unique attribute, when released? |
When can this feature be released ? |
Any update? ;) |
Hi, is there any news regarding this feature? |
As i saw it will be in objectbox 2.0 when it hit GA. Now it's in beta |
All requirement for @unique annotation is for the same usability of SQLite insert queries SQLiteDatabase.CONFLICT_REPLACE option, developers usually uses mobil databases for cache datas to improve response time for queries and they don't want to give their live ObjectId's from server databases, they ussually use GUID's which aren't supported exactly as UUID's but can be stored as Strings in mobil databases. But i think the best approach must be that @uniq annotated fields must be considered as PrimaryKey's which can be given or which can be generated automatically if not specified |
2.0.0 released with Opened #509 for "replace on conflict" - if you require it, please give a thumbs up reaction on the new issue. |
@greenrobot pretty please for a github release/tag? 💯 |
It would be great to have unique annotation so that a put operation can detect, that this row is already existing and needs to be updated instead of creating a new one.
I know this is possible already by making it the @id column and assignable, but sometimes one needs multiple unique columns.
Also this would allow to have different types of keys as one could possibly also use a string.
The text was updated successfully, but these errors were encountered: