Bug 361381 - Constraints are created in unspecified order (DDL creation)
Summary: Constraints are created in unspecified order (DDL creation)
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard: submitted_patch
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-19 08:03 EDT by Sei Syvalta CLA
Modified: 2022-06-09 10:27 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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