Hibernate @Index on @Enumerated field doesn't work
Posted
by mlaverd
on Stack Overflow
See other posts from Stack Overflow
or by mlaverd
Published on 2010-03-29T11:07:39Z
Indexed on
2010/03/29
11:13 UTC
Read the original article
Hit count: 274
I am using Hibernate to talk to my DB. I have one field that is an enumeration and it is going to be used in a slow query. So I'd like to index it. I've put the following annotations on the field:
@Column(name="RIGHT_TYPE", unique=false, nullable=false, length=10) @Enumerated(EnumType.STRING) @Index(name = "ABC_INDEX") protected RightType rightType;
However, I don't see any index on that field created.
But I can create one manually if I wish so. Why is that? Is there any way to force Hibernate to make it happen?
© Stack Overflow or respective owner