-->
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.  [ 2 posts ] 
Author Message
 Post subject: invalid mapping
PostPosted: Wed Jan 05, 2005 7:10 pm 
Regular
Regular

Joined: Sat May 29, 2004 2:16 pm
Posts: 81
Hibernate version:
2.1.7c
Mapping documents:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class
name = "logica.ActoMedico">

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

<property
name = "nomeActoMedico">
<column
name = "actoMedico"
length = "25" />
</property>

<property
name = "nomeUtente" />

<property
name = "convencao">
<column
name = "convencao"
length = "25" />
</property>

<property
name = "data"
type = "date" />

<property
name = "comparticipacao" />

<property
name = "pagoPeloUtente" />

<property
name = "retencaoNaFonte" />

<property
name = "entidade">
<column
name = "entidade"
length = "15" />
</property>

<query name="obtemDadosParaMapa"><![CDATA[
select count(*), am.nomeActoMedico, am.convencao,
sum(am.pagoPeloUtente), sum(am.comparticipacao)
from ActoMedico am
where data >= ? and data <= ?
group by am.nomeActoMedico, am.convencao, am.comparticipacao
order by am.nomeActoMedico asc, am.convencao asc, am.data desc
]]></query>

</class>

</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
List valores = sessao.getNamedQuery("obtemDadosParaMapa")
.setDate(0, new Datas().entraStringSaiDate(sData1))
.setDate(1, new Datas().entraStringSaiDate(sData2)).list();
Full stack trace of any exception that occurs:
Exception in thread "main" java.lang.ExceptionInInitializerError
at utilitarios.HibernateUtil.<clinit>(HibernateUtil.java:37)
at bd.DadosConvencao.devolveActoMedico(DadosConvencao.java:211)
at utilitarios.MensageiroConvencao.obtemActosMedicos(MensageiroConvencao.java:269)
at gui.Visual.povoaComboAM(Visual.java:1338)
at gui.Visual.initialize(Visual.java:1517)
at gui.Visual.<init>(Visual.java:1481)
at gui.Visual.main(Visual.java:1471)
Caused by: net.sf.hibernate.MappingException: Error reading resource: ActoMedico.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 utilitarios.HibernateUtil.<clinit>(HibernateUtil.java:30)
... 6 more
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)
... 11 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,(cache|jcs-cache)?,(id|composite-id),discriminator?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,(subclass*|joined-subclass*))".
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.XMLNSDocumentScannerImpl.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.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)
... 12 more

Name and version of the database you are using:
mysql 4.1

i followed exemple from book at page 249, but i get those error msgs.
What am i doing wrong?
thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 8:11 pm 
Regular
Regular

Joined: Sat May 29, 2004 2:16 pm
Posts: 81
case solved
i guess book should advert query element appears after end class tag


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.