-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ordering of table columns based on position of field in clas
PostPosted: Wed Jun 27, 2012 4:57 pm 
Beginner
Beginner

Joined: Tue Aug 03, 2010 4:32 pm
Posts: 22
when hibernate generates a database table corresponding to a Java class, it seems to make 'id' the first column (so far so good) but all subsequent columns are created in alphabetical order based on field name NOT on position of field in class

Example:

hibernate hbm2ddl takes
Code:
class Foo (
  private Long id;
  private String species;
  private String animal;
)

and makes
Code:
table foo
  long id NOT NULL AUTO_INCREMENT,
  varchar animal,
  varchar species

but what I want is
Code:
table foo
  long id NOT NULL AUTO_INCREMENT,
  varchar species
  varchar animal,


how can I achieve this using annotations?

TIA,

Still-learning Steve


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.