-
Notifications
You must be signed in to change notification settings - Fork 308
String ID aliases #167
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
Comments
I really hope this can be supported soon, love to try it out but having to use long id is quite troublesome |
Would be really, really appreciated if this was added! |
Any ETA? Month or week? I need to know this before public app release ;) |
Hi guys, It will great to support the string ids like other ORMs. In the current situation if we get entities from the server that already exist in the DB then we don't know about it until making the call to the DB and finding these long ids and then copy them... (not a nice code) |
any news about when will this be implemented? |
Of course there are some disadvantage in performance when string is used for primary key. But out of doubt such possibility should be. It's personal responsibility for everyone to use string as id or not. It's good if we have a choice what is more important performance or implementation speed. I wasn't able to use Room from google because it hasn't relations between entities. They explained that all relations should be handled on server side. It's true and it's best practice. But what if I'm not able to change server side because it's third part service. I'm pretty sure that some amount of people can't use ObjectBox because it can't handle string as id. Looking forward! |
In the meantime, has anyone come up with a workaround for this? At the moment, all I can think of is to persist a separate id for MongoDB objects EDIT
|
@obianachebe My workaround in kotlin: |
@Yazon2006 Dangerous thing to do. Hash collisions are quite likely. |
I was going to write the same. But for now, there is no other easy solution. Separate field for storing String id make a lot of mess and each time you need to check if it's not already in db. |
@greenrobot Of course I'm familiar with hash collisions. But in my case it's not a problem 'cause I have exhaustive amount of data in my db and there are no hash collisions. And also I hope that the feature with string id in objectBox will be available until release of my application. |
+1 for String Ids |
expectation |
+1
|
Can you please provide any time estimation for the String type ids implementation? |
Is there a development message about this feature? |
+1 |
2 similar comments
+1 |
+1 |
Btw, a good in-between state is to use |
@greenrobot |
I can see |
@thomasdao +111111 |
@greenrobot |
@greenrobot |
@linguokun1 |
maybe not my bussiness but if you are afraid about limitless strings to produce identifiers, you may firstly consider UUID's as an elemtary type and make them indexable. Since lot's of developers uses Guid's as public indexes or tokens |
Thanks for your suggestion. We prefer long IDs for efficiency. For sync, we use something like UUIDs internally (there's probably no use in exposing those). |
For sync with other databases we would need the UUIDs. Seems you see the point in internal use, but using it for syncing with backend (uses UUID), iOS (uses UUID) and Android (with this DB long :( Beeing offline and using a long as id is no good idea. An UUID is the better way. |
This is a must for me, would be great if you could support that. Specially for those receiving objects coming from a MongoDB database. Unfortunately I'll have to stick with greenDAO for now until this is a supported feature. |
still waiting for..... |
+1 |
Any updates? |
What he said ^ |
Are you guys actively working on this? This is a major pain-point for us! We can't properly use relations in our models and let ObjectBox figure out when an object is new or needs updates, so we have to do a manual look-up each time we want to save something. We used Realm & started migration to ObjectBox because of better API, better support for Architecture Components & no weirdness caused by the no-copy model. And because Realm is so damn slow at implementing features requested by the community (there still are a couple of issues from 2017 I'm still waiting for). We're building a chat platform with lots of features that would benefit from ObjectBox's upcoming sync. But if I can't build the app today without making lots of error & bug prone workarounds there won't be a day when we'll happily pay for the sync service. I moved away from SQL in 2014 and never looked back. Realm worked pretty well for not very complex scenarios & it was still better than writing tons of boilerplate code for SQL. ObjectBox came along at it seemed to be something even better, especially in the context of Android Architecture Components. But for a slightly more complex scenario that doesn't use Long ids, everything falls apart. I'm seriously considering going back to SQL. Room became a pretty solid library. It even supports If the ObjectBox team is not interested in working on this, or has other priorities, just say so! Don't keep us waiting for months on end, for nothing. Thanks, and sorry for the long & ranty message! |
Any updates regarding this issue? The ToOne/ToMany solves only a part of the problem. Can we have an update strategy for relations? Thanks! |
Thanks for all the requests on an update. Our focus is currently on sync. And as always I can't give timelines, sorry. |
After two years of waiting, please give us a definitive timeline when string IDs will be implemented. Customers are waiting for results. Otherwise i have to go back to SQL and never come back to Objectbox. Regards |
Room is a very good alternative for objectbox. |
i get this issues before i use objectbox,it be created before 2years ago,i don't konw whether to choose it |
Are you going to solve this issue? We android developers don't have much more alternatives. At this time room sqlite is the best choice for us. |
This would be a great feature do I don't have to generate two id's to store from server to local database. |
What about Realm? I used on large Android project and its great fast and easy to use DB. Now searching database for Flutter project and Realm does not support it now. I trying ObjectBox but it seems as raw and unfinished library:( |
This is really an important limitation. The possibility of ID with String is very useful for everyone, it's past time for this to be implemented, it's been 4 years of countless requests and justifications. |
No need to use this lib. |
Just pointing out that @Entity
data class Example(
@Id
var id: Long = 0,
@Unique(onConflict = ConflictStrategy.REPLACE)
var uniqueKey: String? = null
) On put, if an object with the String key already exists it will then be removed and a new one inserted. This may already cover some use cases mentioned above. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as spam.
This comment was marked as spam.
Dont bother mate they do nothing but mark as spam 😊 Good luck objectbox. |
If there is an update, like the last one, we will share it. Please only comment if you have something to contribute (e.g. an implementation suggestion, a use case that wasn't mentioned or where the suggested workaround does not work). Otherwise this produces needless work for us (e.g. me checking all new comments for something relevant). And I hid such comments above so it is easier for other users coming here to find the suggested workaround. If you are interested in this feature, please thumbs up the first post. This helps us track interest. |
Offer some convenience to use strings in an ID fashion.
The text was updated successfully, but these errors were encountered: