Julien
Julien

Reputation: 3

ObjectBox: DbDetachedException when accessing a ToOne<>

I would like to know what the following exception corresponds to:

Fatal Exception: io.objectbox.exception.DbDetachedException
Cannot resolve relation for detached entities, call box.attach(entity) beforehand.

It occurred after a call to getTarget() on a ToOne<> relation.

Here is the context:

A component of the application receives external data and creates an object (Entity) of type Measure.

When this object is created, it sends a message to two other components, each running in its own thread: the Recorder and the UI.

One of these components, the Recorder, simply adds the received Measure to a list. If the list reaches a size of 10, it performs a Put() on the Measure Box with the 10 measurements and then clears the list.

The UI component displays the data from the Measure on the screen, using, among other things, the ToOne<> relation that the Measure has.

The application receives 10 measurements per second and has been running for several tens of hours without issue before this crash appeared, so I suspect a multi-threading problem, but I am not entirely sure I understand what the exception means?

Thank you in advance for your clarification :-)

Upvotes: 0

Views: 26

Answers (0)

Related Questions