Home » Support » Forum » Partial Indexing

Partial Indexing

#1

I have a question about partial indexing.

For example, a field of String type ttt, will be distinguished by the first 5 characters, then I can make a index of substr(ttt,1,5) in MySQL.

With ObjectDB, how can I write the annotation for this purpose?

TIA

Institute of Computer Technologies
#2

Currently ObjectDB supports only indexing of complete fields (single field or multiple fields).

The obvious workaround is to add to the entity class an additional field that will hold the partial content. You can keep that partial field synchronized with the main field by using a callback method (which will be annotated with @PrePersist and @PreUpdate). The new field should be indexed and used in queries.

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

Thanks! Your reply do make sense.

Institute of Computer Technologies

Post Reply

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