Hi,
I'm trying to create two bags on the same table of joined-subclasses as follows:
Code:
<class name="Itinerary" table="ITIN_ITINERARY">
<!-- The surrogate id with field level access -->
<id name="id" column="ITINERARY_ID" type="long"/>
...
<bag name="flightSegment" table="ITIN_SEGMENT" inverse="false" cascade="all" lazy="false">
<key column="ITINERARY_ID"/>
<one-to-many class="FlightSegment"/>
</bag>
<bag name="hotelSegment" table="ITIN_SEGMENT" inverse="false" cascade="all" lazy="false">
<key column="ITINERARY_ID"/>
<one-to-many class="HotelSegment"/>
</bag>
</class>
<class name="BaseSegment" table="ITIN_SEGMENT">
<id column="SEGMENT_ID" type="long">
<generator class="native"/>
</id>
...
</class>
<joined-subclass name="FlightSegment" table="ITIN_SEGMENT_AIR"
extends="BaseSegment">
<key column="SEGMENT_ID"/>
<property name="airlineName"/>
...
</joined-subclass>
<joined-subclass name="HotelSegment" table="ITIN_SEGMENT_HOTEL"
extends="BaseSegment">
<key column="SEGMENT_ID"/>
...
</joined-subclass>
When I save an Itinerary using saveOrUpdate() with FlightSegments, but no HotelSegments, Hibernate sets ITINERARY_ID to null in the ITIN_SEGMENT table, and I can't fetch the persisted segments. Any ideas?
Thanks. I'm using Hibernate 3.2.
Steve