Hi all,

For orm files, it is possible to create the XML files using a
namespace, so instead of using

<named-query name="findSomething">
        <query>
        </query>
</named-query>
we can write:
<orm:named-query name="findSomething">
        <orm:query>
        </orm:query>
</orm:named-query>
However, OpenJPA will not process the namespace prefixed declarations.
In org.apache.openjpa.persistence.XMLPersistenceMetaDataParser, the
_elems represents keywords without any namespace and when the XML file
is parsed, org.apache.openjpa.lib.meta.XMLMetaDataParser will call:

public void startElement(String uri, String name, String qName,
        Attributes attrs) throws SAXException {
        _depth++;
        if (_depth <= _ignore)
            if (!startElement(qName, attrs))
                ignoreContent(true);
}
In order to work, the subsequent startElement should be called with
'name' as parameter, which does not have a namespace. The same story
for endElement.
Should namespaces be avoided or it's a bug in OpenJPA?

Environment:
Java 1.6
Glassfish v2
openjpa-1.0.1-r420667

Mircea Lazar

Reply via email to