-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Newbie: Unable to use multiple bags on same table
PostPosted: Thu Dec 27, 2007 8:52 pm 
Newbie

Joined: Thu Dec 27, 2007 8:38 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.