[hibernate-dev] JAXB question
Strong Liu
stliu at hibernate.org
Mon Mar 25 01:51:16 EDT 2013
Hi JAXB expert
I'm trying to do the merge master onto metamodel again, but run into some JAXB problems and I'd like to ask for suggestions.
as you know, we compile the orm.xsd to jaxb generated class, and there is a package-info.java generated for schema validation, this class looks like
{code}
@javax.xml.bind.annotation.XmlSchema(namespace = "http://java.sun.com/xml/ns/persistence/orm", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.hibernate.jaxb.spi.orm;
{code}
but due to the namespace of orm.xsd changed since JPA 2.1 ( from "http://java.sun.com/xml/ns/persistence/orm" to "http://xmlns.jcp.org/xml/ns/persistence/orm", btw, any idea why? )
for now, I created a org.hibernate.jaxb.internal.LegacyJPAEventReader, which will modify the legacy namespace to the new one ( also changing the version to 2.1 )
but with this applied, the jaxb schema validation is always fail no matter which schema is used.
so, I came up with another idea, if the original orm.xml is 2.1 then go ahead with jaxb validation, or, we disable jaxb schema validation and apply stax schema validation before org.hibernate.jaxb.internal.LegacyJPAEventReader came into play
( see org.hibernate.jaxb.internal.JaxbMappingProcessor#unmarshal ) sadly, it doesn't work :( validation still fail, can be reproduced by org.hibernate.metamodel.internal.source.annotations.xml.OrmXmlParserTests#testInvalidOrmXmlThrowsException
so, any suggestions?
-------------------------
Best Regards,
Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio
More information about the hibernate-dev
mailing list