Please try the following: @Entity @org.hibernate.annotations. Table(appliesTo = House. TABLE_NAME, indexes = { @Index(name = "IDX_XDN_DFN", columnNames = {House.
XDN, House. DFN} ) } ) @Table(name="house") public class House { ... } Note that this should also allow you to create a multi-column index (based on the index name): @Index(name = "index1") public String getFoo(); @Index(name = "index1") public String getBar(); P.S. : What version of bernate are you using BTW? What database/dialect?
You'd better go with a composite primary key. This article explains how to do it with JPA annotations. It uses @Embeddable and @EmbeddedId.
Thank you. Use JPA specific API is right thing but ... it's still not clear why it doesn't work on jboss. I've tried to use the same class specifying @Index annotation for separate fields but it doesn't work too.
– Zaur_M Feb 2 '10 at 9:42 Did you read the article? Use Embeddable and EmbeddedId. – Bozho Feb 2 '10 at 9:50 It's not necessary to make entity embeddable in my business logic.
There must be more simplest decision. But don't know yet how to do it .... Yes, I've read that article. – Zaur_M Feb 2 '10 at 9:54 1 this is the simplest and best solution.
Since your primary key is composite, you better abstract it a a new object. – Bozho Feb 2 '10 at 10:08 Bozho, I totally agree with U, but I want to do less redesign of business domain classes (entities), because it's already used by the application. – Zaur_M Feb 2 '10 at 10:17.
You have to have hibernate. Hbm2ddl. Auto set to create in persistence.xml.
When set to update hibernate won't create indexes. Hbm2ddl. Auto = create.
I've tried to do like you sad, but indexes were not created – Zaur_M Mar 3 '10 at 14:10 may be it was because of jboss version – Zaur_M Mar 3 '10 at 14:22.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.