Hi all,
I am using EJB3 with hibernate.hbm2ddl.auto=update. I notice the primary keys is been created in database in alphabetic order and not like the order defined at the embedded class. I look at the source code of Hibernate Annotations and found in AnnotationBinder class a Collections.sort at line 1024 with this comment:
Code:
//order so that property are used in the same order when binding native query
In my project I have primary keys with 4 or 5 fields, and many queries use only 2 ou 3 of them and are running very slow, and the cause was the wrong order of the primary keys in the database.
I guest that sort is for fixing another bug, but is really annoying, because I need to look each primary key and adjust its order by hand.
Is there another solution?
Thanks in advance.