Skip to content

To-One Relations: __boxStore field missing #47

@MjCodeTinker

Description

@MjCodeTinker

When I use The To - One Relations

For example:

@entity
public class Order {
@id long id;

long customerId;

@Relation Customer customer;

/** Used to resolve relations */
@Internal
@Generated(hash = 1307364262)
transient BoxStore __boxStore;

@Generated(hash = 789963847)
public Order(long id, long customerId) {
    this.id = id;
    this.customerId = customerId;
}

@Generated(hash = 1105174599)
public Order() {

}

...
...

}

@entity
public class Customer {

@Id long id;
...

}

When I call in the activity and setCustom () will throw an exception

    Customer customer=new Customer(0,"test");
    Order order=new Order(0,0);
    order.setCustomerId(0);
    order.setCustomer(customer);   // This code

    orderBox.put(order);

java.lang.IllegalStateException: java.lang.NoSuchFieldException: __boxStore

at io.objectbox.internal.ReflectionCache.getField(ReflectionCache.java:31)

at io.objectbox.relation.ToOne.ensureBoxes(ToOne.java:73)

at io.objectbox.relation.ToOne.setTarget(ToOne.java:126)

at com.mj.rx.practice.no_sql.Order.setCustomer(Order.java:80)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions