mirror of https://github.com/apache/openjpa.git
OPENJPA-1047: Prohibit Table annotation or XML descriptor element for MappedSuperclass.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@835292 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
965c997c24
commit
8c952771dc
|
@ -62,6 +62,7 @@ import org.apache.openjpa.meta.ValueMetaData;
|
||||||
import org.apache.openjpa.persistence.XMLPersistenceMetaDataParser;
|
import org.apache.openjpa.persistence.XMLPersistenceMetaDataParser;
|
||||||
import org.apache.openjpa.util.InternalException;
|
import org.apache.openjpa.util.InternalException;
|
||||||
import org.apache.openjpa.util.MetaDataException;
|
import org.apache.openjpa.util.MetaDataException;
|
||||||
|
import org.apache.openjpa.util.UserException;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.Locator;
|
import org.xml.sax.Locator;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -781,11 +782,13 @@ public class XMLPersistenceMappingParser
|
||||||
*/
|
*/
|
||||||
private boolean startTable(Attributes attrs)
|
private boolean startTable(Attributes attrs)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
|
ClassMapping mapping = (ClassMapping) currentElement();
|
||||||
|
if (mapping.isAbstract())
|
||||||
|
throw new UserException(_loc.get("table-not-allowed", mapping));
|
||||||
String table = toTableName(attrs.getValue("schema"),
|
String table = toTableName(attrs.getValue("schema"),
|
||||||
attrs.getValue("name"));
|
attrs.getValue("name"));
|
||||||
if (table != null)
|
if (table != null)
|
||||||
((ClassMapping) currentElement()).getMappingInfo().setTableName
|
mapping.getMappingInfo().setTableName(table);
|
||||||
(table);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,4 +59,7 @@ discriminator-on-abstract-class: A discriminator value has been specified for \
|
||||||
implicit-non-default-fk: While parsing "{0}" from "{1}", found a @ForeignKey \
|
implicit-non-default-fk: While parsing "{0}" from "{1}", found a @ForeignKey \
|
||||||
with implicit attribute set to true but one or more other attributes of \
|
with implicit attribute set to true but one or more other attributes of \
|
||||||
ForeignKey is set to their non-default value. You can not specify any \
|
ForeignKey is set to their non-default value. You can not specify any \
|
||||||
non-default value for an implicit ForeignKey.
|
non-default value for an implicit ForeignKey.
|
||||||
|
table-not-allowed: You have specified Table annotation or XML descriptor element \
|
||||||
|
for MappedSuperclass "{0}". A class designated as a mapped superclass can not \
|
||||||
|
have a separate table defined for it.
|
Loading…
Reference in New Issue