Hi,
i'm trying to set additional indices on a MySQL-databasetable. This is the relevant part of the code:
Code:
@Entity
@javax.persistence.Table(name = "tb_myTable")
@org.hibernate.annotations.Table(appliesTo = "tb_myTable", fetch=FetchMode.JOIN, indexes={ @Index(name="my_idx", columnNames={"field","another"}) } )
public class MyClass {
private double field;
private double another;
....
@Column
public double getField() {
return field;
}
public void setField(double field) {
this.field = field;
}
@Column
public double getAnother() {
return another;
}
public void setAnother(double another) {
this.another = another;
}
...
}
If i try to validate, if the indices were set by using the mysql-console (
show index from tb_myTable, i see that there are no indices (except the primary key indices).
what's the problem, or what am I doing wrong? I read, that it's no problem to mix the JPA @Table annotation with the Hibernate @Table annotation this way.
Thanks in advance.