hi friends,
I found out how to do it now.
This association is nothing but a parent and child association. And child and parent are both associated hence there is no change in the POJOs. Slight changes in the mapping xml.
Mapping xml:
Floor-
<hibernate-mapping default-access="field">
<class name="com.spring.orm.FloorBean" table="fl_floor">
<id name="Id" column="FL_FLOOR_ID" >
<generator class="native" />
</id>
<many-to-one name="facility" class="com.spring.orm.FacilityBean" column="FL_FACILITY_ID"/>
</class>
</hibernate-mapping>
The column that stores the facility id is a association with Facility object in the FloorBean class.
Facility-
<hibernate-mapping default-access="field">
<class name="com.spring.orm.FacilityBean" table="fm_facility_master">
<id name="Id" column="FM_FACILITY_ID" >
<generator class="native" />
</id>
<set name="floors" inverse="true" lazy="false" cascade="none">
<key column="FL_FACILITY_ID"/>
<one-to-many class="com.spring.orm.FloorBean"/>
</set>
</class>
</hibernate-mapping>
By setting inverse="true" and cascade="none" both parent and child can be inserted independently. And association still persists.
This is the link where associations are explained very well.
http://www.neeraj.name/43/hibernate-association-behind-the-scene-action 