I'm using hibernate 2.1, MySql 2.0.12-nt, j2sdk1.4.2_04
My app has a class - Relatorio - that is composed of two classes: Turma and Disciplina.
Turma has a child - Detalhe.
Here are my mapping docs:
Relatorio:
Code:
<?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 = "relatorio.Relatorio" table = "relatorios">
<id name = "id" column = "id" unsaved-value = "null">
<generator class = "increment" />
</id>
<many-to-one name = "turma" column = "rel_turmas" class = "relatorio.Turma"
cascade="all">
</many-to-one>
<many-to-one name = "mat" column = "rel_mat" class = "relatorio.Disciplina"
cascade="all">
</many-to-one>
<many-to-one name = "pt" column = "rel_pt" class = "relatorio.Disciplina"
cascade="all">
</many-to-one>
<many-to-one name = "cn" column = "rel_cn" class = "relatorio.Disciplina"
cascade="all">
</many-to-one>
</class>
</hibernate-mapping>
Turma:
[code]<?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 = "relatorio.Turma" table = "turmas">
<id name = "id" column = "id" unsaved-value = "null">
<generator class = "increment" />
</id>
<property name = "turma" column = "turma" />
<property name = "ano" column = "ano" />
<property name = "masculinos" column = "masculinos" />
<property name = "femininos" column = "femininos" />
<!-- retirei lazy = true para poder fechar a sess