Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » composite key order
composite key order [message #787660] Tue, 31 January 2012 21:05 Go to next message
Tony Rozga is currently offline Tony RozgaFriend
Messages: 2
Registered: January 2012
Junior Member
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.

Re: composite key order [message #789189 is a reply to message #787660] Thu, 02 February 2012 18:06 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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.

James : Wiki : Book : Blog : Twitter
Previous Topic:Composite Key Configuration using Dynamic Eclipse Link API
Next Topic:How does EclipseLink use equals() and hashCode()?
Goto Forum:

Current Time: Mon Aug 03 15:58:39 GMT 2020

Powered by FUDForum. Page generated in 0.01950 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top