[b]Hibernate version: [/b] 2.1.4
[b]Mapping documents:[/b]
<class name="Member" table="MEMBER">
<id name="id" column="KMEMBER" type="integer">
<generator class="native"/>
</id>
<property name="memname" column="MEMNAME" type="string" not-null="true" />
<one-to-one name="memberAssociation" class="MemberAssociation" property-ref="child"/>
</class>
<class name="MemberAssociation" table="MEMBER_ASSOCIATION">
<id name="id" column="KMA" type="integer">
<generator class="native"/>
</id>
<property name="parent" column="FKPARENT" type="integer" not-null="true" />
<property name="child" column="FKCHILD" type="integer" not-null="true" />
</class>
<class name="MemberAddress" table="MEMBER_ADDRESS">
<id name="id" column="KMADDR" type="integer">
<generator class="native"/>
</id>
<property name="member" column="FKMEMBER" type="integer" not-null="true" />
<property name="address" column="ADDRESS" type="string" not-null="true" />
</class>
I wish to obtain the childs and their parents (but not every child has a parent).
I tryed something like this, but id doesn't work...
select
cmember.memname, pmember.memname, ma.address
from
Member as cmember,
Member as pmember,
MemberAddress as ma
left join fetch
cmember.memberAssociation memberAssociation
where
memberAssociation.parent = pmember.id and
pmember.id = ma.member
|