Here is my model:
class User {
@CollectionOfElements
@JoinTable(name = "user_type", joinColumns = @JoinColumn(name = "user_id"))
@Column(name = "type", nullable = false)
private List<String> types = new ArrayList<String>();
}
As you can imagine there would be a table called "user_type", which has two columns, one is "user_id" and the other is "type".
When I use hbm2ddl to generate the ddls, I want to have this table, along with the foreign key constraint on "user_id". However, there is no index for this column. How can I get hibernate to generate the index for me?