Hello,
I am going to use composite indexes for Active Objects, I’m refactoring existing code that only has indexes on single fields at this time. [AO 1.2.0 upgrade guide](http://AO 1.2.0 upgrade guide)
Javadoc:
https://javadoc.io/static/net.java.dev.activeobjects/activeobjects/3.1.7/net/java/ao/schema/Indexed.html
https://javadoc.io/static/net.java.dev.activeobjects/activeobjects/3.1.7/net/java/ao/schema/Index.html
I have some queries that join a foreign key field (the ID of a foreign key AO) and some other local field. Is it possible (or necessary) to create a composite index for such a query?
For example:
public interface Parent extends Entity {
@OneToMany(reverse = "getParent")
getChilds()
...
@Indexes({
// TODO: HOW? IS THIS RIGHT? OR NECESSARY?
@Index(name="parent_something", methodNames = {"getParent", "getSomething"})
})
public interface Child extends Entity {
getParent()
setParent()
@Indexed // for queries on only this field
getSomething()
setSomething()
doSomeQuery() {
... "PARENT_ID = ? AND SOMETHING = ?" ... // composite index required?
}
...