[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Column Order in EJB3 / Hibernate auto generated tables

jochen.reinhardt do-not-reply at jboss.com
Fri Mar 20 18:52:30 EDT 2009


Hi folks!

FYI, I am using EJB3 with JBoss AS 5.0.1 and MySQL 5.1 as database.
I use schema auto generation for my entities (EJB3 through standard annotations). I just discovered that all fields are sorted alphabetically. I would not mind this, but it is also true for my compound primary keys.

I already posted a similar question in the EJB3 forum - but I did not receive an answer there. So as my question concerns EJB persistence with JBoss I thought my question might be answered here, as Hibernate actually runs under the hood. Please correct me if I am misstaken.

And that is not what i want. I want to have the fields I search regularly at the beginning of the key, so that MySQL can use the key. Is there a way to take influence on the column order?

I would like my fields to appear in the same order as defined in the entity. I already tried using @Embeddable and @EmbeddedId with and without @AttributeOverrides.

I do not really want to name my columns a_..., b_... just to get a correct column order. Is there some documentation about this behaviour?
Should I create the tables myself, not using table schema autogeneration?

Thank's in advance.

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

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



More information about the jboss-user mailing list