This content has been marked as final.
Show 5 replies
-
1. Re: Hibernate specific @Index annotation is ignored
rhodan76 May 20, 2008 6:22 AM (in response to winterer)This bug(?) seems to further exist. Anyone got @Index working inside jboss ?
-
2. Re: Hibernate specific @Index annotation is ignored
jaikiran May 20, 2008 6:57 AM (in response to winterer)Please post the version of JBoss and Java, you are using. Also, post the code where @Index is used and also the persistence.xml file.
While posting the logs or xml content or code, remember to wrap it in a code block using the Code button in the message editor window and please hit the Preview button to make sure your post is correctly formatted -
3. Re: Hibernate specific @Index annotation is ignored
rhodan76 May 20, 2008 7:39 AM (in response to winterer)We are using:
Jboss 4.2.2 GA
Hibernate EntityManager 3.2.1.GA
Hibernate Annotations 3.2.1.GA
Hibernate 3.2.4.sp1
Following example for defining the index:@Column @org.hibernate.annotations.Index(name = "test_idx") public String getUserName() { return this.userName; }
Bug seems to be related to the persistence.xml entry:<property name="hibernate.hbm2ddl.auto" value="create-drop" />
Index generation ONLY works when hibernate.hbm2ddl.auto is set to "create-drop", in any other case the index is NOT created. I'm shure, anybody understands, that 'create-drop' is not an appropriate value for production systems. -
4. Re: Hibernate specific @Index annotation is ignored
jaikiran May 20, 2008 8:12 AM (in response to winterer)"Rhodan" wrote:
Index generation ONLY works when hibernate.hbm2ddl.auto is set to "create-drop" in any other case the index is NOT created.I'm shure, anybody understands, that 'create-drop' is not an appropriate value for production systems.
It works with hibernate.hbm2ddl.auto = "create" too.<properties> <property name="hibernate.hbm2ddl.auto" value="create"/> </properties>
As for why, it doesn't work with "update", see this http://www.hibernate.org/119.html#A10 -
5. Re: Hibernate specific @Index annotation is ignored
rhodan76 May 20, 2008 9:15 AM (in response to winterer)Sometimes it's mystical. I could swear i tested with "create" and it was not working. But now i checked again and as you said it worked with "create".
Thank you !