Adding multi part path index on non-embedable object member


Is there a way to add single member index on members of a object member which is not configured embedable but is/are mapped by id like the two members below. 

@Entity public class Customer {

    @ManyToOne(fetch = FetchType.LAZY)
    private Merchant merchant;

    @ManyToOne(fetch = FetchType.LAZY)
    private List<Store> stores;

    // Setter/Getter


So I wanted to add index on Customer for or on given those merchant and Store class has the corresponding fields.


    @Index(members={"", ...etc... })
public class Customer { ... }

There is a documentation says it works on embedded objects only. So since it reference only, what is suggested way of doing this?

Hope to hear your advice and solutions.


The index definition is invalid, since a multi path index is limited to one entity class (and additional embeddable classes) but cannot spread over multiple entity classes.

You may split a multi path index to two separate indexes, e.g.

  • A simple index on the collection of stores.
  • A composite index on the fields in Store.

ObjectDB will maintain each index separately but will join them together in relevant queries.

ObjectDB Support