[hibernate-dev] JAXB question
Steve Ebersole
steve at hibernate.org
Mon Mar 25 10:46:36 EDT 2013
Not a JAXB expert, so take this all with a grain of salt...
http://docs.oracle.com/javaee/5/api/javax/xml/bind/annotation/XmlSchema.html
is completely unintelligible to me. I guess it assumes a certain level
of XML/JAXP knowledge that I simple lack.
I'd be interested to see what happens if you simply remove that
package-info?
On 03/25/2013 12:51 AM, Strong Liu wrote:
> 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
>
>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
More information about the hibernate-dev
mailing list