These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Error with composite id
PostPosted: Wed May 19, 2004 12:27 pm 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
I have this composite id (generated by middlegen)

<composite-id name="comp_id" class="hibernate.bean.OrderItemPK">
<meta attribute="class-description" inherit="false">
@hibernate.id
generator-class="assigned"
</meta>
<key-property
name="sku"
column="SKU"
type="java.lang.String"
length="50"
>
<meta attribute="field-description">
@hibernate.property
column="SKU"
length="50"
</meta>
</key-property>
<key-property
name="lineRef"
column="LINE_REF"
type="java.lang.String"
length="4"
>
<meta attribute="field-description">
@hibernate.property
column="LINE_REF"
length="4"
</meta>
</key-property>
<!-- bi-directional many-to-one association to Order -->
<key-many-to-one
name="order"
class="hibernate.bean.Order"
>
<meta attribute="field-description">
@hibernate.many-to-one
column="TRANSACTION_ID""
</meta>
<column name="TRANSACTION_ID" />
</key-many-to-one>
</composite-id>



I am loading it using Spring Framework and I get this error:

*Wondering if my DTD is out of synch or something?





09:11:21,031 INFO [main] net.sf.hibernate.cfg.Configuration:285 - Mapping resource: hibernate/bean/OrderItem.hbm.xml
09:11:21,078 ERROR [main] net.sf.hibernate.util.XMLHelper:48 - Error parsing XML: XML InputStream(41) The content of element type "key-property" must match "(column)*".
09:11:21,078 ERROR [main] net.sf.hibernate.util.XMLHelper:48 - Error parsing XML: XML InputStream(54) The content of element type "key-property" must match "(column)*".
09:11:21,093 ERROR [main] net.sf.hibernate.util.XMLHelper:48 - Error parsing XML: XML InputStream(65) The content of element type "key-many-to-one" must match "(column)*".
09:11:21,093 INFO [main] net.sf.hibernate.cfg.Binder:198 - Mapping class: hibernate.bean.OrderItem -> ORDER_ITEM
09:11:21,343 ERROR [main] org.springframework.web.context.ContextLoader:86 - Failed to initialize application context
org.springframework.beans.FatalBeanException: Can't resolve reference to bean 'hibernateSupport' while setting property 'hibernate' on bean 'hsqlHibernateSupport'; nested exception is:
org.springframework.beans.FatalBeanException: Can't resolve reference to bean 'hibernateOracleSessionFactory' while setting property 'sessionFactory' on bean 'hibernateSupport'; nested exception is:
org.springframework.beans.FatalBeanException: afterPropertiesSet() on bean with name 'hibernateOracleSessionFactory' threw exception; nested exception is:
net.sf.hibernate.MappingException: Error reading resource: hibernate/bean/OrderItem.hbm.xml
org.springframework.beans.FatalBeanException: Can't resolve reference to bean 'hibernateOracleSessionFactory' while setting property 'sessionFactory' on bean 'hibernateSupport'; nested exception is:
org.springframework.beans.FatalBeanException: afterPropertiesSet() on bean with name 'hibernateOracleSessionFactory' threw exception; nested exception is:
net.sf.hibernate.MappingException: Error reading resource: hibernate/bean/OrderItem.hbm.xml
org.springframework.beans.FatalBeanException: afterPropertiesSet() on bean with name 'hibernateOracleSessionFactory' threw exception; nested exception is:
net.sf.hibernate.MappingException: Error reading resource: hibernate/bean/OrderItem.hbm.xml
net.sf.hibernate.MappingException: Error reading resource: hibernate/bean/OrderItem.hbm.xml
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:292)
at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:209)
at org.springframework.beans.factory.support.AbstractBeanFactory.callLifecycleMethodsIfNecessary(AbstractBeanFactory.java:883)
at org.springframework.beans.factory.support.AbstractBeanFactory.createBean(AbstractBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:211)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveReference(AbstractBeanFactory.java:823)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveValueIfNecessary(AbstractBeanFactory.java:794)
at org.springframework.beans.factory.support.AbstractBeanFactory.applyPropertyValues(AbstractBeanFactory.java:761)
at org.springframework.beans.factory.support.AbstractBeanFactory.createBean(AbstractBeanFactory.java:479)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:211)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveReference(AbstractBeanFactory.java:823)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveValueIfNecessary(AbstractBeanFactory.java:794)
at org.springframework.beans.factory.support.AbstractBeanFactory.applyPropertyValues(AbstractBeanFactory.java:761)
at org.springframework.beans.factory.support.AbstractBeanFactory.createBean(AbstractBeanFactory.java:479)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:211)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:469)
at org.springframework.context.support.AbstractApplicationContext.preInstantiateSingletons(AbstractApplicationContext.java:355)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:241)
at org.springframework.web.context.support.XmlWebApplicationContext.setServletContext(XmlWebApplicationContext.java:124)
at org.springframework.web.context.ContextLoader.initContext(ContextLoader.java:58)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:29)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3271)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3613)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:307)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:788)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
at org.apache.catalina.core.StandardService.start(StandardService.java:497)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Caused by: net.sf.hibernate.MappingException: invalid mapping
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:267)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:289)
... 46 more
Caused by: org.xml.sax.SAXParseException: The content of element type "key-property" must match "(column)*".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:339)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:266)
... 47 more


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 19, 2004 1:44 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
meta are not allowed inside key-property

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Middlegen
PostPosted: Wed May 19, 2004 1:50 pm 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
Is there some way to have middlegen updated so that it complies to this constraint? Besides just turning off all meta generation, or removing it manually.

Troy


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 19, 2004 4:43 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Hum forget my post.
You're using an old version (DTD version) of Hibernate. Please upgrade

_________________
Emmanuel


Top
 Profile  
 
 Post subject: dtd
PostPosted: Thu May 20, 2004 12:18 am 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
I am using hibernate 2.1.2

The dtd in the samples shows using:

http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd

Which is what I am using in every case.

How do I determine if/what it should be.


Troy


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 21, 2004 7:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
It should find the DTD in the Hibernate Jar file rather than Sourceforge version which is still Hibernate 2.0.x series.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.