OPENJPA-150 : Re-use parseColumns method when parsing AttributeOverride columns

so that we get secondary table information.  



git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@509674 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
A. Abram White 2007-02-20 17:37:18 +00:00
parent 1b446958f5
commit 372b83736d
1 changed files with 4 additions and 18 deletions

View File

@ -378,8 +378,6 @@ public class AnnotationPersistenceMappingParser
private void parseAttributeOverrides(ClassMapping cm,
AttributeOverride... attrs) {
FieldMapping sup;
javax.persistence.Column scol;
int unique;
for (AttributeOverride attr : attrs) {
if (StringUtils.isEmpty(attr.name()))
throw new MetaDataException(_loc.get("no-override-name", cm));
@ -387,13 +385,8 @@ public class AnnotationPersistenceMappingParser
if (sup == null)
sup = (FieldMapping) cm.addDefinedSuperclassField(attr.name(),
Object.class, Object.class);
scol = attr.column();
if (scol == null)
continue;
unique = (scol.unique()) ? TRUE : FALSE;
setColumns(sup, sup.getValueInfo(), Arrays.asList
(new Column[]{ newColumn(scol) }), unique);
if (attr.column() != null)
parseColumns(sup, attr.column());
}
}
@ -967,20 +960,13 @@ public class AnnotationPersistenceMappingParser
throw new MetaDataException(_loc.get("not-embedded", fm));
FieldMapping efm;
javax.persistence.Column ecol;
int unique;
for (AttributeOverride attr : attrs) {
efm = embed.getFieldMapping(attr.name());
if (efm == null)
throw new MetaDataException(_loc.get("embed-override-name",
fm, attr.name()));
ecol = attr.column();
if (ecol == null)
continue;
unique = (ecol.unique()) ? TRUE : FALSE;
setColumns(efm, efm.getValueInfo(), Arrays.asList
(new Column[]{ newColumn(ecol) }), unique);
if (attr.column() != null)
parseColumns(efm, attr.column());
}
}