mirror of https://github.com/apache/openjpa.git
Changes for JIRA OPENJPA-103 issue.
The processing for default (system level) pre-* and post-* lifecycle methods was not getting kicked off properly. I just had to add a case entry for these MetaDataTags in the switch statement. git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@497219 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ef67680a55
commit
bb7bf59409
|
@ -72,7 +72,7 @@ import org.apache.openjpa.util.UnsupportedException;
|
||||||
public class XMLPersistenceMetaDataParser
|
public class XMLPersistenceMetaDataParser
|
||||||
extends CFMetaDataParser
|
extends CFMetaDataParser
|
||||||
implements PersistenceMetaDataFactory.Parser {
|
implements PersistenceMetaDataFactory.Parser {
|
||||||
|
|
||||||
// parse constants
|
// parse constants
|
||||||
protected static final String ELEM_PKG = "package";
|
protected static final String ELEM_PKG = "package";
|
||||||
protected static final String ELEM_ACCESS = "access";
|
protected static final String ELEM_ACCESS = "access";
|
||||||
|
@ -86,7 +86,7 @@ public class XMLPersistenceMetaDataParser
|
||||||
protected static final String ELEM_CASCADE_REF = "cascade-refresh";
|
protected static final String ELEM_CASCADE_REF = "cascade-refresh";
|
||||||
protected static final String ELEM_PU_META = "persistence-unit-metadata";
|
protected static final String ELEM_PU_META = "persistence-unit-metadata";
|
||||||
protected static final String ELEM_PU_DEF = "persistence-unit-defaults";
|
protected static final String ELEM_PU_DEF = "persistence-unit-defaults";
|
||||||
protected static final String ELEM_XML_MAP_META_COMPLETE =
|
protected static final String ELEM_XML_MAP_META_COMPLETE =
|
||||||
"xml-mapping-metadata-complete";
|
"xml-mapping-metadata-complete";
|
||||||
|
|
||||||
private static final Map<String, Object> _elems =
|
private static final Map<String, Object> _elems =
|
||||||
|
@ -106,7 +106,7 @@ public class XMLPersistenceMetaDataParser
|
||||||
_elems.put(ELEM_PU_META, ELEM_PU_META);
|
_elems.put(ELEM_PU_META, ELEM_PU_META);
|
||||||
_elems.put(ELEM_PU_DEF, ELEM_PU_DEF);
|
_elems.put(ELEM_PU_DEF, ELEM_PU_DEF);
|
||||||
_elems.put(ELEM_XML_MAP_META_COMPLETE, ELEM_XML_MAP_META_COMPLETE);
|
_elems.put(ELEM_XML_MAP_META_COMPLETE, ELEM_XML_MAP_META_COMPLETE);
|
||||||
|
|
||||||
_elems.put("entity-listeners", ENTITY_LISTENERS);
|
_elems.put("entity-listeners", ENTITY_LISTENERS);
|
||||||
_elems.put("pre-persist", PRE_PERSIST);
|
_elems.put("pre-persist", PRE_PERSIST);
|
||||||
_elems.put("post-persist", POST_PERSIST);
|
_elems.put("post-persist", POST_PERSIST);
|
||||||
|
@ -458,12 +458,21 @@ public class XMLPersistenceMetaDataParser
|
||||||
case ENTITY_LISTENERS:
|
case ENTITY_LISTENERS:
|
||||||
ret = startEntityListeners(attrs);
|
ret = startEntityListeners(attrs);
|
||||||
break;
|
break;
|
||||||
|
case PRE_PERSIST:
|
||||||
|
case POST_PERSIST:
|
||||||
|
case PRE_REMOVE:
|
||||||
|
case POST_REMOVE:
|
||||||
|
case PRE_UPDATE:
|
||||||
|
case POST_UPDATE:
|
||||||
|
case POST_LOAD:
|
||||||
|
ret = startCallback((MetaDataTag) tag, attrs);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
warnUnsupportedTag(name);
|
warnUnsupportedTag(name);
|
||||||
}
|
}
|
||||||
} else if (tag == ELEM_PU_META || tag == ELEM_PU_DEF)
|
} else if (tag == ELEM_PU_META || tag == ELEM_PU_DEF)
|
||||||
ret = isMetaDataMode();
|
ret = isMetaDataMode();
|
||||||
else if (tag == ELEM_XML_MAP_META_COMPLETE)
|
else if (tag == ELEM_XML_MAP_META_COMPLETE)
|
||||||
setAnnotationParser(null);
|
setAnnotationParser(null);
|
||||||
else if (tag == ELEM_ACCESS)
|
else if (tag == ELEM_ACCESS)
|
||||||
ret = _mode != MODE_QUERY;
|
ret = _mode != MODE_QUERY;
|
||||||
|
@ -708,7 +717,7 @@ public class XMLPersistenceMetaDataParser
|
||||||
protected boolean startClass(String elem, Attributes attrs)
|
protected boolean startClass(String elem, Attributes attrs)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
super.startClass(elem, attrs);
|
super.startClass(elem, attrs);
|
||||||
|
|
||||||
// query mode only?
|
// query mode only?
|
||||||
_cls = classForName(currentClassName());
|
_cls = classForName(currentClassName());
|
||||||
if (_mode == MODE_QUERY) {
|
if (_mode == MODE_QUERY) {
|
||||||
|
@ -1510,7 +1519,7 @@ public class XMLPersistenceMetaDataParser
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
_listener = classForName(attrs.getValue("class"));
|
_listener = classForName(attrs.getValue("class"));
|
||||||
boolean system = currentElement() == null;
|
boolean system = currentElement() == null;
|
||||||
Collection<LifecycleCallbacks>[] parsed =
|
Collection<LifecycleCallbacks>[] parsed =
|
||||||
AnnotationPersistenceMetaDataParser.parseCallbackMethods(_listener,
|
AnnotationPersistenceMetaDataParser.parseCallbackMethods(_listener,
|
||||||
null, true, true, _repos);
|
null, true, true, _repos);
|
||||||
if (parsed == null)
|
if (parsed == null)
|
||||||
|
@ -1580,14 +1589,14 @@ public class XMLPersistenceMetaDataParser
|
||||||
for (int i = 0; i < events.length; i++) {
|
for (int i = 0; i < events.length; i++) {
|
||||||
int event = events[i];
|
int event = events[i];
|
||||||
if (_listener != null) {
|
if (_listener != null) {
|
||||||
MetaDataParsers.validateMethodsForSameCallback(_listener,
|
MetaDataParsers.validateMethodsForSameCallback(_listener,
|
||||||
_callbacks[event], ((BeanLifecycleCallbacks) adapter).
|
_callbacks[event], ((BeanLifecycleCallbacks) adapter).
|
||||||
getCallbackMethod(), callback, def, getLog());
|
getCallbackMethod(), callback, def, getLog());
|
||||||
} else {
|
} else {
|
||||||
MetaDataParsers.validateMethodsForSameCallback(_cls,
|
MetaDataParsers.validateMethodsForSameCallback(_cls,
|
||||||
_callbacks[event], ((MethodLifecycleCallbacks) adapter).
|
_callbacks[event], ((MethodLifecycleCallbacks) adapter).
|
||||||
getCallbackMethod(), callback, def, getLog());
|
getCallbackMethod(), callback, def, getLog());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (_callbacks[event] == null)
|
if (_callbacks[event] == null)
|
||||||
_callbacks[event] = new ArrayList<LifecycleCallbacks>(3);
|
_callbacks[event] = new ArrayList<LifecycleCallbacks>(3);
|
||||||
|
|
Loading…
Reference in New Issue