-->
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.  [ 3 posts ] 
Author Message
 Post subject: not-null must be declared for element type key-property
PostPosted: Fri Feb 04, 2005 3:02 pm 
Beginner
Beginner

Joined: Fri Feb 04, 2005 2:44 pm
Posts: 25
Location: Buffalo, NY
I have a database table that uses 8 columns as a primary key, so I'm declaring a composite-id. Any ideas on what's wrong? I try adding the not-null property, but it didn't make a difference. TIA.

Hibernate version:
2.1

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="converter.Psched" table="PSCHED">

<composite-id>
<key-property name="study" column="STUDY" type="string"/>
<key-property name="patid"/>
<key-property name="step"/>
<key-property name="ver"/>
<key-property name="fname"/>
<key-property name="keyval"/>
<key-property name="seq"/>
<key-property name="tdate" type="calendar"/>
</composite-id>

<property name="sname">
<column name="SNAME" type="string" length="50" not-null="true"/>
</property>

<property name="vtitle"/>
<property name="keyunt"/>
<property name="winunt"/>
<property name="winval"/>
<property name="ddate" type="calendar"/>
<property name="req"/>
<property name="reason"/>
<property name="comp"/>
<property name="sysdat" type="calendar"/>
<property name="dchng" type="calendar"/>

</class>

</hibernate-mapping>

Full stack trace of any exception that occurs:
13:45:09,937 INFO Environment:478 - Hibernate 2.1.7
13:45:09,953 INFO Environment:507 - hibernate.properties not found
13:45:09,953 INFO Environment:538 - using CGLIB reflection optimizer
13:45:09,953 INFO Environment:567 - using JDK 1.4 java.sql.Timestamp handling
13:45:09,968 INFO Configuration:900 - configuring from resource: /hibernate.cfg.xml
13:45:09,968 INFO Configuration:872 - Configuration resource: /hibernate.cfg.xml
13:45:10,625 INFO Configuration:331 - Mapping resource: hib/Psched.hbm.xml
13:45:10,843 INFO Binder:230 - Mapping class: converter.Psched -> PSCHED
13:45:11,359 INFO Configuration:331 - Mapping resource: hib/T_ddmiss.hbm.xml
13:45:11,437 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(11) Attribute "not-null" must be declared for element type "key-property".
13:45:11,437 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(12) Attribute "not-null" must be declared for element type "key-property".
13:45:11,437 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(13) Attribute "not-null" must be declared for element type "key-property".
13:45:11,437 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(14) Attribute "not-null" must be declared for element type "key-property".
13:45:11,437 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(15) Attribute "not-null" must be declared for element type "key-property".
13:45:11,437 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(16) Attribute "not-null" must be declared for element type "key-property".
13:45:11,437 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(17) Attribute "not-null" must be declared for element type "key-property".
net.sf.hibernate.MappingException: Error reading resource: hib/T_ddmiss.hbm.xml
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:339)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1018)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:974)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:902)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:888)
at converter.ConvertToLegacy.<init>(ConvertToLegacy.java:38)
at converter.ConvertToLegacy.main(ConvertToLegacy.java:30)
Caused by: net.sf.hibernate.MappingException: invalid mapping
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:287)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
... 6 more
Caused by: org.xml.sax.SAXParseException: Attribute "not-null" must be declared for element type "key-property".
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.addDTDDefaultAttrsAndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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.XML11Configuration.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:286)
... 7 more
java.lang.NullPointerException
at converter.ConvertToLegacy.convert(ConvertToLegacy.java:51)
at converter.ConvertToLegacy.main(ConvertToLegacy.java:31)
Exception in thread "main"

Name and version of the database you are using:
Ingres II 2.6


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 05, 2005 7:41 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
key-property is not null by design so don't override this (check the DTD for more infos)

_________________
Emmanuel


Top
 Profile  
 
 Post subject: not-found for many-to-many problem
PostPosted: Thu Sep 15, 2005 4:41 pm 
Newbie

Joined: Thu Sep 15, 2005 4:24 pm
Posts: 1
Location: NY USA
Please Help

Exception:

org.hibernate.MappingException: Error reading resource: inventory/beans/Model.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:444)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1358)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1330)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1312)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1279)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1207)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1193)
at inventory.DAO.HibernateDAO.setup(HibernateDAO.java:49)
at inventory.DAO.HibernateDAO.<init>(HibernateDAO.java:43)
at org.apache.jsp.bulb_jsp._jspService(bulb_jsp.java:128)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.ja
va:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:391)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:441)
... 59 more
Caused by: org.xml.sax.SAXParseException: Attribute "not-found" must be declared for element type "many-to-man
y".
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.addDTDDefaultAttrsAndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown So
urce)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.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 org.hibernate.cfg.Configuration.addInputStream(Configuration.java:390)
... 60 more

Mapping:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
package="inventory.beans">

<class name="Model">
<id name="id">
<generator class="native"/>
</id>

<property name="model" type="string" length="16" not-null="true" unique="true"/>

<set name="compatibleModels" table="compatible_models" >
<key column="model_id"/>
<many-to-many class="Model" column="compatible_model" not-found="ignore"/>
</set>
</class>

</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.