Ola pessoal,
Estou com dificuldade em rodar uma pequena aplicação de duas tabelas.
1 Municipio para N Praia
hibernate.cfg.xml
[code]<?xml version="1.0" encoding="utf-8"?>
com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/sin org.hibernate.dialect.MySQLDialect true root 123</session-factory>
[/code]
Municipio.hbm.xml
[code]
<one-to-many name="praia" class="Praia"column="codPraia" />
</class>
[/code]
Praia.hbm.xml
[code]
<many-to-one name="municipio"class="Municipio"column="codMunicipio" />
</set>
</class>
[/code]
Teste
[code]package testes;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import bean.Municipio;
public class AddMunicipio {
public static void main(String[] args) {
SessionFactory sf = new Configuration().configure("/conf/hibernate.cfg.xml").buildSessionFactory();
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
Municipio municipio = new Municipio();
municipio.setDescMunicipio("palhoça");
session.save(municipio);
tx.commit();
session.close();
}
}
[/code]
Aparece o seguinte erro:
Error on line 12 of document : Element type “one-to-many” must be followed by either attribute specifications, “>” or “/>”. Nested exception: Element type “one-to-many” must be followed by either attribute specifications, “>” or “/>”
Alguem poderia me dar um help?
Obrigado