Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361381

Summary: Constraints are created in unspecified order (DDL creation)
Product: z_Archived Reporter: Sei Syvalta <syvalta>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: submitted_patch

Description Sei Syvalta CLA 2011-10-19 08:03:17 EDT
Build Identifier: 2.3.0

In DDL creation constraints are created in unspecified order. This is very similar to https://bugs.eclipse.org/bugs/show_bug.cgi?id=330237.

Fix: Change getUniqueConstraints in org.eclipse.persistence.internal.helper.DatabaseTable to create LinkedHashMap instead of HashMap:
    public Map<String, List<List<String>>> getUniqueConstraints() {
        if (this.uniqueConstraints == null) {
            this.uniqueConstraints = new HashMap<String, List<List<String>>>();
        }
to
    public Map<String, List<List<String>>> getUniqueConstraints() {
        if (this.uniqueConstraints == null) {
            this.uniqueConstraints = new LinkedHashMap<String, List<List<String>>>();
        }

Also changing foreignKeyMap in org.eclipse.persistence.tools.schemaframework.TableDefinition to LinkedHashMap would probably make sense for consistent ordering (note that clone also creates a new instance of the map).


Reproducible: Always

Steps to Reproduce:
Run schema generation several times (possibly on different machines) and compare the order of constraint creation clauses in the resulting SQL.
Comment 1 Sei Syvalta CLA 2011-10-19 08:08:31 EDT
If it helps I can provide a patch, but as the changes are very trivial I thought it doesn't help much.
Comment 2 Tom Ware CLA 2011-10-31 13:49:46 EDT
no need to provide a patch.  I hope to take a look at the bugs with submitted patches prior to our 2.3.2 patch.
Comment 3 Tom Ware CLA 2011-11-09 13:52:30 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:27:22 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink