[hibernate-dev] hibernate-mapping-4.0.xsd issue?

Hardy Ferentschik hardy at hibernate.org
Tue Aug 9 11:58:22 EDT 2011


Have you tried switching property and timestamp?

  <class name="SimpleEntity" >
     <id name="id" access="field">
       <generator class="increment"/>>     	
     </id>
     <timestamp name="date" access="field"/>
     <property name="name" access="field"/>
   </class>

order matters in this case

--Hardy


On Tue, 09 Aug 2011 17:40:46 +0200, Strong Liu <stliu at hibernate.org> wrote:

> ------------------------   hbm   --------------------------------------
> <hibernate-mapping package="org.hibernate.metamodel.source.hbm"  
> xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
>                    xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping  
> hibernate-mapping-4.0.xsd"
>                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
>     <class name="SimpleEntity" >
>
>     	<id name="id" access="field">
>     		<generator class="increment"/>
>     	</id>
>         <property name="name" access="field"/>
>         <timestamp name="date" access="field"/>
> 	</class>
>
> </hibernate-mapping>
>
> --------------------------- stacktrace  
> ------------------------------------
>
> 23:32:19,942  INFO Environment:2573 - HHH00412:Hibernate [WORKING]
> 23:32:20,010  INFO Environment:1986 - HHH00205:Loaded properties from  
> resource hibernate.properties:  
> {hibernate.connection.driver_class=org.h2.Driver,  
> hibernate.max_fetch_depth=5,  
> hibernate.dialect=org.hibernate.dialect.H2Dialect,  
> hibernate.format_sql=true,  
> hibernate.cache.region.factory_class=org.hibernate.testing.cache.CachingRegionFactory,  
> hibernate.connection.username=sa,  
> hibernate.cache.region_prefix=hibernate.test,  
> hibernate.connection.url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE,  
> hibernate.bytecode.use_reflection_optimizer=false,  
> hibernate.show_sql=true, hibernate.connection.pool_size=5}
> 23:32:20,012  INFO Environment:945 - HHH00021:Bytecode provider name :  
> javassist
> 23:32:20,143  INFO Dialect:3062 - HHH00400:Using dialect:  
> org.hibernate.dialect.H2Dialect
>
> org.hibernate.metamodel.source.MappingException: Unable to perform  
> unmarshalling at line number 36 and column 48. Message:  
> cvc-complex-type.2.4.a: Invalid content was found starting with element  
> 'timestamp'. One of  
> '{"http://www.hibernate.org/xsd/hibernate-mapping":property,  
> "http://www.hibernate.org/xsd/hibernate-mapping":many-to-one,  
> "http://www.hibernate.org/xsd/hibernate-mapping":one-to-one,  
> "http://www.hibernate.org/xsd/hibernate-mapping":component,  
> "http://www.hibernate.org/xsd/hibernate-mapping":dynamic-component,  
> "http://www.hibernate.org/xsd/hibernate-mapping":properties,  
> "http://www.hibernate.org/xsd/hibernate-mapping":any,  
> "http://www.hibernate.org/xsd/hibernate-mapping":map,  
> "http://www.hibernate.org/xsd/hibernate-mapping":set,  
> "http://www.hibernate.org/xsd/hibernate-mapping":list,  
> "http://www.hibernate.org/xsd/hibernate-mapping":bag,  
> "http://www.hibernate.org/xsd/hibernate-mapping":idbag,  
> "http://www.hibernate.org/xsd/hibernate-mapping":array,  
> "http://www.hibernate.org/xsd/hibernate-mapping":primitive-array,  
> "http://www.hibernate.org/xsd/hibernate-mapping":join,  
> "http://www.hibernate.org/xsd/hibernate-mapping":subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":joined-subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":union-subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":loader,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-insert,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-update,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-delete,  
> "http://www.hibernate.org/xsd/hibernate-mapping":filter,  
> "http://www.hibernate.org/xsd/hibernate-mapping":fetch-profile,  
> "http://www.hibernate.org/xsd/hibernate-mapping":resultset,  
> "http://www.hibernate.org/xsd/hibernate-mapping":query,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-query}' is expected.
> 	at  
> org.hibernate.metamodel.source.internal.JaxbHelper.unmarshal(JaxbHelper.java:166)
> 	at  
> org.hibernate.metamodel.source.internal.JaxbHelper.unmarshal(JaxbHelper.java:82)
> 	at org.hibernate.metamodel.MetadataSources.add(MetadataSources.java:171)
> 	at  
> org.hibernate.metamodel.MetadataSources.addResource(MetadataSources.java:160)
> 	at  
> org.hibernate.metamodel.source.hbm.TypeResolveTests.testSimpleEntityMapping(TypeResolveTests.java:82)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at  
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at  
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> 	at  
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at  
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at  
> org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:63)
> 	at  
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> 	at  
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> 	at  
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> 	at  
> org.hibernate.testing.junit4.FailureExpectedHandler.evaluate(FailureExpectedHandler.java:59)
> 	at  
> org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
> 	at  
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
> 	at  
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> 	at  
> org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:43)
> 	at  
> org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:42)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> 	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
> 	at  
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:71)
> 	at  
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:199)
> 	at  
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content  
> was found starting with element 'timestamp'. One of  
> '{"http://www.hibernate.org/xsd/hibernate-mapping":property,  
> "http://www.hibernate.org/xsd/hibernate-mapping":many-to-one,  
> "http://www.hibernate.org/xsd/hibernate-mapping":one-to-one,  
> "http://www.hibernate.org/xsd/hibernate-mapping":component,  
> "http://www.hibernate.org/xsd/hibernate-mapping":dynamic-component,  
> "http://www.hibernate.org/xsd/hibernate-mapping":properties,  
> "http://www.hibernate.org/xsd/hibernate-mapping":any,  
> "http://www.hibernate.org/xsd/hibernate-mapping":map,  
> "http://www.hibernate.org/xsd/hibernate-mapping":set,  
> "http://www.hibernate.org/xsd/hibernate-mapping":list,  
> "http://www.hibernate.org/xsd/hibernate-mapping":bag,  
> "http://www.hibernate.org/xsd/hibernate-mapping":idbag,  
> "http://www.hibernate.org/xsd/hibernate-mapping":array,  
> "http://www.hibernate.org/xsd/hibernate-mapping":primitive-array,  
> "http://www.hibernate.org/xsd/hibernate-mapping":join,  
> "http://www.hibernate.org/xsd/hibernate-mapping":subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":joined-subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":union-subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":loader,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-insert,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-update,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-delete,  
> "http://www.hibernate.org/xsd/hibernate-mapping":filter,  
> "http://www.hibernate.org/xsd/hibernate-mapping":fetch-profile,  
> "http://www.hibernate.org/xsd/hibernate-mapping":resultset,  
> "http://www.hibernate.org/xsd/hibernate-mapping":query,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-query}' is  
> expected.]
> 	at  
> com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:414)
> 	at  
> com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:395)
> 	at  
> com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:368)
> 	at  
> org.hibernate.metamodel.source.internal.JaxbHelper.unmarshal(JaxbHelper.java:155)
> 	... 36 more
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:  
> Invalid content was found starting with element 'timestamp'. One of  
> '{"http://www.hibernate.org/xsd/hibernate-mapping":property,  
> "http://www.hibernate.org/xsd/hibernate-mapping":many-to-one,  
> "http://www.hibernate.org/xsd/hibernate-mapping":one-to-one,  
> "http://www.hibernate.org/xsd/hibernate-mapping":component,  
> "http://www.hibernate.org/xsd/hibernate-mapping":dynamic-component,  
> "http://www.hibernate.org/xsd/hibernate-mapping":properties,  
> "http://www.hibernate.org/xsd/hibernate-mapping":any,  
> "http://www.hibernate.org/xsd/hibernate-mapping":map,  
> "http://www.hibernate.org/xsd/hibernate-mapping":set,  
> "http://www.hibernate.org/xsd/hibernate-mapping":list,  
> "http://www.hibernate.org/xsd/hibernate-mapping":bag,  
> "http://www.hibernate.org/xsd/hibernate-mapping":idbag,  
> "http://www.hibernate.org/xsd/hibernate-mapping":array,  
> "http://www.hibernate.org/xsd/hibernate-mapping":primitive-array,  
> "http://www.hibernate.org/xsd/hibernate-mapping":join,  
> "http://www.hibernate.org/xsd/hibernate-mapping":subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":joined-subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":union-subclass,  
> "http://www.hibernate.org/xsd/hibernate-mapping":loader,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-insert,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-update,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-delete,  
> "http://www.hibernate.org/xsd/hibernate-mapping":filter,  
> "http://www.hibernate.org/xsd/hibernate-mapping":fetch-profile,  
> "http://www.hibernate.org/xsd/hibernate-mapping":resultset,  
> "http://www.hibernate.org/xsd/hibernate-mapping":query,  
> "http://www.hibernate.org/xsd/hibernate-mapping":sql-query}' is expected.
> 	at  
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
> 	at  
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
> 	at  
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
> 	at  
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
> 	at  
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:417)
> 	at  
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3182)
> 	at  
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1806)
> 	at  
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
> 	at  
> com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:550)
> 	at  
> com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:78)
> 	at  
> com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
> 	at  
> com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.handleStartElement(StAXEventConnector.java:247)
> 	at  
> com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge(StAXEventConnector.java:116)
> 	at  
> com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:392)
> 	... 38 more
>
>
> Process finished with exit code 255
>
>
> -----------
> Strong Liu <stliu at hibernate.org>
> http://hibernate.org
> http://github.com/stliu



More information about the hibernate-dev mailing list