-->
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: Different Generator for Each Subclass in Inheritance
PostPosted: Sat Sep 18, 2010 12:09 pm 
Newbie

Joined: Sun Aug 15, 2010 10:35 am
Posts: 4
Am using "Table per concrete class with unions" hibernate mapping strategy. Each child is saved in a different table and the ids have to start from 1 sequentially. Is there a way for each the children to have different generators?

The mapping file:-

Code:

<hibernate-mapping>
      <class name="test.Bl" abstract="true">
         <id name="id" column="ID" type="integer">
            <generator class="sequence">
               <param name="sequence">SQ_ID</param>
            </generator>
         </id>
         <property name="consignee" column="CONSIGNEE" type="string" />

         <union-subclass name="test.SeaBl"
            table="TMP_SEA_BL">
            <property name="blNo" column="BL_NO" />
         </union-subclass>

         <union-subclass name="test.Awb" table="TMP_AWB">
            <property name="awbNo" column="AWB" />
         </union-subclass>
      </class>
</hibernate-mapping>



I wanted every child to have its own <id> and consequently generator, but i realize the construct is not allowed in the case above, i.e. can't have <id> inside union-subclass.

NB: The generator is an Oracle sequence.


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.