naveenhibernate wrote:
hai
please let me know how to implement outer join using hibernate ( hsql)
i have two tables Person ( personid, name)
and Address ( addressno, addressdesc, personid)
how to implement outer join
personid - primary key
addressno - primary key
personid - foreign key
mapping files:
Person.hbm.xml:
<?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="Person" table="person">
<id name="personid" column="personid" type="long" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" column="name"/>
<set name="adds" cascade="all" inverse="true" lazy="true">
<key column="personid"/>
<one-to-many class="Address"/>
</set>
</class>
</hibernate-mapping>
Address.hbm.xml
<?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="Address" table="address">
<id name="addressno" column="addressno" type="long" unsaved-value="0">
<generator class="native"/>
</id>
<property name="addressdesc" column="addressdesc"/>
<many-to-one name="friends" class="Person" column="personid"/>
</class>
</hibernate-mapping>