Problem with Composite indices



I want to realize the following: I have 2 classes, one Client class which looks like:

public class Client
    @Index (unique = "true")
    private String name;

and a User class which looks like:

@Index (members = {"client", "emails"})
public class User
    private Client client;
    private List<String> emails;

So I want to be sure that each User which belongs to one Client has an unique Email address but only in relation to a specific Client (e.g. Client "a"->User "", Client "b"->User "").

No I get the exception: Invalid index path 'emails' in type User

How can I realize such constraint?

Kind regards


This uniqueness constraint has to be enforced by the application.

Unfortunately a composite index on a field + a collection is not allowed.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Ok. Thanks

Post Reply

To post a reply and/or subscribe to update notifications - please login