Hi Hibernate team,
I found that when we created the tables using Hibernate, the columns sequence of the created tables is not the same with the sequence of entity fields. And I also found most of the related source codes are using LinkedHashMap or List to keep the fields(or properties) in order, so I believe that Hibernate is aiming to keep the same sequence of the table columns as entity fields. I traced the source codes and found that in the org.hibernate.cfg.PropertyContainer , TreeMap is used to keep the fields. I replaced all the TreeMap with LinkedHashMap, without modifing any other codes, it works -- table columns get the same order as fields defined in entity.
Hope that you will notice this post. And if it is the case, modify it in next version, then we can enjoy this.
Thanks a lot, Ryan Wang
|