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