composite key order [message #787660] |
Tue, 31 January 2012 16:05  |
Eclipse User |
|
|
|
Hi, I have a @Inheritance(strategy=InheritanceType.JOINED) situation with a composite primary key and a base class + a subclass. There doesn't appear to be a way to tell Eclipselink about pk column order so I get two tables with keys in different order.
any way to fix that? We have a desired order based on selectivity. We are targeting SqlServer and this means we have two clustered keys in different column order...and these two tables get joined. I can't imagine that is good.
I played around with DescriptorCustomizer..setPrimaryKeyFields seems to work for the baseclass..the subclass however has an empty getPrimaryKeyFields and setAdditionalTablePrimaryKeyFields using a LinkedHashMap didn't work.
I guess an alternative is to not rely on automagic ddl and instead roll my own. However, I'm unsure about the implications of doing that, especially when it comes to the efficiency of any queries that get generated by EclipseLink.
tnx
|
|
|
Re: composite key order [message #789189 is a reply to message #787660] |
Thu, 02 February 2012 13:06  |
Eclipse User |
|
|
|
EclipseLink's DDL generation does not allow the control of the order of the columns, nor is there anything in JPA for this.
DDL generation is normally for rapid prototyping, so if you are concerned about very specific things for production, you are probably best off using your own DDL scripts.
Does it really matter the order of the columns? I would think the database would not care, or would reorder them to be optimal for its purposes.
You could log an enhancement to have some sort of SessionEvent raised for DDL generation that would allow you to control the field order, and other specific things.
Or possible log a bug to have the class field order to be attempted to be respected to the column order.
|
|
|
Powered by
FUDForum. Page generated in 0.57237 seconds