[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - @Index annotation

georgesberscheid do-not-reply at jboss.com
Fri Oct 10 13:23:23 EDT 2008


I'm trying to use the @Index annotation with EJB3 in Hibernate 3.2.6.ga to create indexes automatically when an entity is deployed. According to the documentation it can be put either into the @org.hibernate.annotations.Table annotation or directly on the entity property.

Unfortunately, neither
@javax.persistence.Table(name = "records")
  | @org.hibernate.annotations.Table(appliesTo = "records", indexes = { @Index(name = "IDX", columnNames = { "timestamp" }) })
nor at Index(name = "IDX", columnNames = { "timestamp" })
  | public Date getTimestamp() {
  | 	return timestamp;
  | }
  | nor at Index(name = "IDX")
  | public Date getTimestamp() {
  | 	return timestamp;
  | }
  |  seem to work.

It does create the table on deploy, creates all the foreign keys associated with the entity, creates indexes on the foreign key columns, but the indexes specified using @Index are missing.

Any hints?

Thanks a lot,

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181591#4181591

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181591

More information about the jboss-user mailing list