Improve relations to play nicer with server APIs (e.g. Retrofit, GSON, Jackson, Moshi, ...)
See original GitHub issueIf you get object data from another source (e.g. server) you can make those data objects also ObjectBox entities. One thing has to be considered: relations on ObjectBox currently rely on ToOne
and ToMany
types, which 3rd party libraries are not aware of.
A quick work around would probably be to walk through the object graph and replace List
objects with ToMany
objects.
However, we could also look into supporting plain java.util.List
s in some way. A put
would have to detect the type and do some additional syncing to figure out what to do. Or maybe just plainly put
all objects in the list?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:26
- Comments:61 (12 by maintainers)
Top Results From Across the Web
Android Networking II: OkHttp, Retrofit, Moshi and Picasso
Retrofit is a type-safe REST adapter that makes easy common networking tasks. Retrofit turns your REST API into a Java interface and uses ......
Read more >Consuming APIs with Retrofit | CodePath Android Cliffnotes
See this guide about leveraging the Gson library for more information about how to create your own Java classes for use with Retrofit....
Read more >GSON to Moshi migration - the good, the bad and ... - Wolt Blog
We at Wolt have recently migrated the default JSON parser in our Android application from GSON to Moshi.
Read more >Goodbye Gson, Hello Moshi - ProAndroidDev
✓ Better API: · You can create annotations of your own to customize parsing of a field in your JSON data, (@ColorInt @FromHexColor...
Read more >Why use Moshi over Gson? : r/androiddev - Reddit
For example he argues that Gson doesn't correct the fact that the Date ... Moshi has a better, more opinionated API with less...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I concur in regards to having an annotation based solution
@ToOne
@ToMany
POJOS or in this case entities should not be closely tied to a database.Having something like:
@Many List<Stuff> stuff
Would solve many of the issues here
Is there any news on this? Currently running into this exact same issue (of toOne’s not being recognised by a 3rd party), and would love to keep on using ObjectBox without having to build costly wrappers around everything…