-->
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: How To: Hibernate creates a table with specific fields order
PostPosted: Fri May 13, 2011 12:17 am 
Beginner
Beginner

Joined: Fri Jun 23, 2006 6:40 pm
Posts: 25
Dear Members

I have an Entity class (among others) declared in this way

Code:
@Entity
@Table(name = "articulo")
public class Articulo implements Serializable {

   private static final long serialVersionUID = 1L;

   private Long idArticulo;

   private String codigoArticulo;

   private String descripcionArticulo;

   private BigDecimal stockActualArticulo;

   private BigDecimal stockMinimoArticulo;

   private BigDecimal costoUnitarioArticulo;

   private BigDecimal totalValorizadoArticulo;

   private Medida medida;

   private LineaCategoria lineaCategoria;



Notice the order of the class's properties, the getters and setters are generated in the same order than each property with Eclipse and the getters are annotated with the respective annotation need it from javax.persistence.*.

Then Hibernate creates the respective table mapping for mysql , here no problem

But I did realize the follow, when I do desc articulo in MySQL I get

Code:
| Field                  |
|                        |
|------------------------+
|idArticulo              |
|codigoArticulo          |
|costoUnitarioArticulo   |
|descripcionArticulo     |
|stockActualArticulo     |
|stockMinimoArticulo     |
|totalValorizadoArticulo |
|idLineaCategoria        |
|idMedida                |


It has a complete different order than the order of the properties declared in the class, is normal this?

Exists an option to force Hibernate to respect the order of the properties of my class to be represented in a 100% in the same order in the Mysql's table?

Thanks in Advanced

_________________
kill your pride, share your knowledge with all


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.