Version: 2.1.3
I have ReferenceEntity and ReferenceObligation. A ReferenceEntity has many ReferenceObligations
Code:
<hibernate-mapping>
<class
name="ReferenceEntity"
table="REFERENCE_ENTITY"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="id"
type="java.lang.Long"
>
<generator class="native">
</generator>
</id>
<property
name="name"
type="java.lang.String"
update="true"
insert="true"
column="name"
/>
<set
name="referenceObligations"
lazy="false"
inverse="true"
cascade="all-delete-orphan"
sort="unsorted"
>
<key
column="referenceEntityId"
/>
<one-to-many
class="ReferenceObligation"
/>
</set>
</class>
</hibernate-mapping>
Code:
<hibernate-mapping>
<class
name="ReferenceObligation"
table="REFERENCE_OBLIGATION"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="id"
type="java.lang.Long"
>
<generator class="native">
</generator>
</id>
<property
name="name"
type="java.lang.String"
update="true"
insert="true"
column="name"
/>
<many-to-one
name="referenceEntity"
class="ReferenceEntity"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="referenceEntityId"
not-null="true"
/>
</class>
</hibernate-mapping>
I have a simple HQL query like this:
"SELECT referenceEntity from ReferenceEntity AS referenceEntity join referenceEntity.referenceObligations as referenceObligation "
Executed like this:
Code:
Query query = session.createQuery(queryString);
List resultList = query.list();
This query now returns multiple times a ReferenceEntity object (exactely each time for the number of ReferenceObligations). Am I missing something?
Many thanks!!!!