1

I try to add compostite Index in enttiy but not work following error got :

[error] application - message= Unexpected database state: BTree 49 is not found, cause=  [ObjectDB 2.5.4] javax.persistence.PersistenceException 
Unexpected database state: BTree 49 is not found (error 147

Model Classes:

@Entity
@Table(name = Customer.TABLE_NAME)
@javax.jdo.annotations.Index(members=            
     {"addresses.firstName,addresses.lastName,addresses.company"})
public class Customer extends ObjectDBBaseModel<Customer> {
    List<Address> addresses;
}


@Entity
@Table(name = Address.TABLE_NAME)
public class Address<T extends ObjectDBBaseModel> extends ObjectDBBaseModel<T> {

    public static final String TABLE_NAME = "address";
    public static final Address NULL = new Address();
    public static ODBFinder<Address> find = new ODBFinder<>(Address.class, NULL);

    public Address() {
        super((Class<T>) Address.class);
    }

    @Column(name = "address_type_enum")
    @Enumerated(EnumType.STRING)
    private AddressTypeEnum addressTypeEnum;

    @Column(name = "gender_enum")
    @Enumerated(EnumType.STRING)
    private GenderEnum genderEnum;

    private String title;

    private String firstName;

    private String lastName;

    private String company;

    private String street1;
}
jmvivo
  • 2,653
  • 1
  • 16
  • 20
ASHISH
  • 45
  • 1
  • 6

1 Answers1

1

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.

In this case you should use two separate indexes:

  • Simple index on the collection of addresses.
  • Composite index on the three fields in Address.

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

ObjectDB
  • 1,312
  • 8
  • 9