OPENJPA-456 committing patch provided by Teresa Kan

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@603633 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2007-12-12 14:59:12 +00:00
parent 265be5d1bd
commit 45eb530812
1 changed files with 8 additions and 2 deletions

View File

@ -157,9 +157,15 @@ public class PersistenceMappingDefaults
name = inverses[0].getName(); name = inverses[0].getName();
else else
name = fm.getDefiningMapping().getTypeAlias(); name = fm.getDefiningMapping().getTypeAlias();
String targetName = ((Column) target).getName();
String tempName = null;
if ((name.length() + targetName.length()) >= dict.maxColumnNameLength)
tempName = name.substring(0, dict.maxColumnNameLength
- targetName.length() - 1);
// suffix with '_' + target column // suffix with '_' + target column
name += "_" + ((Column) target).getName(); if (tempName == null)
tempName = name;
name = tempName + "_" + targetName;
name = dict.getValidColumnName(name, foreign); name = dict.getValidColumnName(name, foreign);
col.setName(name); col.setName(name);
} }