I have the following spring-data-jpa
entity:
@Entity(name = "absenceDays")
@Table
public final class MyTable {
@EmbeddedId
private MyId myId;
@Column(nullable = false)
private Long anotherId;
}
further, this is the @Embeddable
entity used above:
public final class MyId implements Serializable {
@Column(updatable = false, nullable = false)
private Long id;
@Column(updatable = false, nullable = false)
private LocalDate date;
}
I have couple of questions?
- Are tables already indexed with their primary keys? It seems to be implementation specific, as discussed here When should I use primary key or index?
- How should I index my table with the composite id using the JPA 2.1
@Index
annotation, if I need to index my table?
My DB of choice will be AWS RDS with MySQL InnoDB dialect.