I have a mapped superclass with two already indexed properties. now i want to create a group index over both properties. until now it worked with:
@MappedSuperclass
Class A {
@Index(name="pa")
int a;
@Index(name="pb")
int b;
}
According to the hibernate documentation i could annotate my new index with @Table (hibernate annotation). but i dont know what to set for the required appliesTo parameter.
has anybody tried this successfully before?
From Hibernate Documentation:
Update:
For the @MappedSuperclass you could try to use @Tables annotation
But that seems rather tedious.
Note that, @Index annotation has columnNames property, which allows you to specify more than one column. However, I’m not sure whether you should duplicate index definition for each field.