question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve relations to play nicer with server APIs (e.g. Retrofit, GSON, Jackson, Moshi, ...)

See original GitHub issue

If 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.Lists 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:open
  • Created 6 years ago
  • Reactions:26
  • Comments:61 (12 by maintainers)

github_iconTop GitHub Comments

23reactions
ArthurSavcommented, Mar 4, 2018

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

9reactions
YBthebestcommented, Oct 4, 2017

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found