Sven,
The first example is a simplified one (I preferred to put little code). The last example is the real situation.
Sala contains Cesta
Cesta contains Ocorrencia
Ocorrencia is not ordered.
Sala mapping (initial post)
Cesta mapping:
Code:
<hibernate-mapping package="br.atech.atendeCOS.model">
<class name="Cesta" table="CESTA" schema="ADMCOS" lazy="false">
<id name="codigo" type="java.lang.Long">
<column name="COD_CESTA" scale="3" precision="0"
not-null="true" unique="true" sql-type="NUMBER" />
<generator class="increment" />
</id>
<many-to-one name="sala" class="Sala">
<column name="COD_SALA" scale="2" precision="0"
not-null="false" />
</many-to-one>
<property name="nome" type="java.lang.String">
<column name="DSC_CESTA" scale="30" precision="0"
not-null="true" sql-type="VARCHAR2" />
</property>
<bag name="ocorrencias" table="OCORRENCIA_CESTA" inverse="true" lazy="false">
<key column="COD_CESTA" />
<many-to-many column="COD_OCORRENCIA" unique="true" class="Ocorrencia" />
</bag>
</class>
</hibernate-mapping>
The SQL output is very very big (a lot of selects). Is there a e-mail to send it?
Regards,
Andre