Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] Bug fix for TableDefinition.buildForeignKeyConstraintName

Hi,

I've fixed a but in TableDefinition that is apparently filed in glassfish, but not fixed there (see https://glassfish.dev.java.net/issues/show_bug.cgi?id=3554)
The bug still exists in the 2.0 nightly snapshot.

                    if (foreignKeyName.length() > maximumNameLength) {
                        // Still too long: remove vowels from the table name and field name and truncate the table name.
                        String shortenedFieldName = Helper.removeVowels(onlyAlphaNumericFieldName);
                        String shortenedTableName = Helper.removeVowels(onlyAlphaNumericTableName);
                        foreignKeyName = Helper.truncate(shortenedTableName, maximumNameLength - shortenedFieldName.length()) + shortenedFieldName;
                    }

becomes 

 if (foreignKeyName.length() > maximumNameLength) {
                        // Still too long: remove vowels from the table name and field name and truncate the table name.
                        String shortenedFieldName = Helper.removeVowels(onlyAlphaNumericFieldName);
                        String shortenedTableName = Helper.removeVowels(onlyAlphaNumericTableName);
                        
                        if (shortenedFieldName.length() >= maximumNameLength) {
                         foreignKeyName = Helper.truncate(shortenedFieldName, maximumNameLength);
                        } else {
                            foreignKeyName = Helper.truncate(shortenedTableName, maximumNameLength - shortenedFieldName.length()) + shortenedFieldName;
                        }
                    }

Gregor

Back to the top