-->
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.  [ 4 posts ] 
Author Message
 Post subject: not-null" must be declared for element type "id&qu
PostPosted: Thu Aug 25, 2005 4:52 am 
Newbie

Joined: Thu Aug 25, 2005 4:32 am
Posts: 1
why error when run
error info:

16:46:52,093 ERROR [XMLHelper] Error parsing XML: XML InputStream(8) Attribute "
not-null" must be declared for element type "id".
16:46:52,093 INFO [STDOUT] org.hibernate.MappingException: Error reading resour
ce: com/hmit/hub/entity/hbm/Datalog.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.jav
a:1313)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.jav
a:1285)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1267)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1234)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1162)
at com.hmit.hub.entity.db.InitHibernate.init(InitHibernate.java:56)
at com.hmit.hub.entity.db.HibernateUtilPlus.getSystemSessionFactory(Hibe
rnateUtilPlus.java:129)
at com.hmit.hub.entity.db.HibernateUtilPlus.currentSession(HibernateUtil
Plus.java:46)
at org.jbpm.scheduler.impl.SchedulerThread.executesimple(SchedulerThread
.java:77)
at org.jbpm.scheduler.impl.SchedulerThread.run(SchedulerThread.java:45)
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:396
)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:446)
... 10 more
Caused by: org.xml.sax.SAXParseException: Attribute "not-null" must be declared
for element type "id".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known 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.addDTDDefaultAttrsAndValid
ate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown
Source)
this is my *.hbm.xml

<?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>
<class name="com.hmit.hub.entity.base.Datalog"
table="HUB_DATALOG">
<id name="logId" type="long" unsaved-value="null">
<column name="LOGID" not-null="true" />
<generator class="native">
</generator>
</id>
<property name="logLevel" column="LOGLEVEL" type="string"
not-null="false" />
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 5:21 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Your XML is not well formed

You define column as a new element and never close it. Try this instead

Code:
<hibernate-mapping>
   <class name="com.npower.mds.audit.model.Customer">
      <id name="id" type="java.lang.Long" unsaved-value="null" column="id">
         <generator class="native" />
      </id>
      <property name="customerName" type="java.lang.String"
         unique="true" not-null="true" length="128" />
   </class>
</hibernate-mapping>



Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 5:22 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Ignore the comment about not closing column.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 8:08 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you're not showing the right parsed file.

_________________
Emmanuel


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