hi
i'm beginning in hibernate
I made my first one mapping, but it gave an error
it's error
Code:
Exception in thread "main" org.hibernate.MappingException: Error reading resource: uti/Paciente.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:452)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
at Prontuario.<init>(Prontuario.java:33)
at Prontuario.main(Prontuario.java:82)
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:399)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
... 8 more
mapping:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!--
Document : Hibernate.cfg.xml
Created on : 9 de Agosto de 2005, 10:58
Author : gian
Description:
Purpose of the document follows.
-->
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="connection.url">jdbc:postgresql://localhost:5432/UTI</property>
<property name="connection.username">postgres</property>
<property name="connection.password">telmed</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">net.sf.hibernate.dialect.PostgreSQLDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="uti/Paciente.hbm.xml"/>
</session-factory>
</hibernate-configuration>
and
Code:
<?xml version='1.0' encoding='utf-8'?>
<!--
Document : Paciente.hbm.xml
Created on : 8 de Agosto de 2005, 10:48
Author : gian
Description:
Purpose of the document follows.
-->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-mapping>
<class name="Paciente"
table="PACIENTE">
<id
name = "codPac"
column = "CODPAC">
<generactor class = "native"/>
</id>
<property
name = "numeroRegistro"
column = "NUM_REGISTRO"
type = "int"/>
<property
name = "nome"
column = "NOME"
type = "string"/>
<property
name = "dataNasc"
column = "DATA_NASC"
type = "date"/>
<property
name = "sexo"
column = "SEXO"
type = "string"/>
<property
name = "fone01"
column = "FONE01"
type = "string"/>
<property
name = "fone02"
column = "FONE02"
type = "string"/>
<property
name = "complemento"
column = "COMPLEMENTO"
type = "string"/>
<property
name = "peso"
column = "PESO"
type = "float"/>
<property
name = "altura"
column = "ALTURA"
type = "float"/>
<property
name = "nomeMae"
column = "NOME_MAE"
type = "string"/>
<property
name = "naturalMunicipio"
column = "NATURAL_MUNICIPIO"
type = "string"/>
<property
name = "naturalUF"
column = "NATURAL_UF"
type = "string"/>
<property
name = "tipoSang"
column = "TIPO_SANG"
type = "string"/>
<property
name = "rhSang"
column = "RG_SANG"
type = "string"/>
<property
name = "uid"
column = "UID"
type = "string"/>
</class>
</hibernate-mapping>
somebody can help me?
tanks :)