I have the following Hibernate Mapping, which has to be mapped using the Table per Concrete Class Hierarchy:
<hibernate-mapping package='dao'>
<meta attribute='class-description'></meta>
<class name='PropertyDAO'>
<id name='id' column='id_property'>
<generator class='assigned'/>
</id>
<property name='address' column='address' type='string'/>
<union-subclass name='HouseDAO' table='house'>
<property name='noOfRooms' column='noOfRooms'/>
<property name='totalArea' column='totalArea'/>
<property name='price' column='price'/>
</union-subclass>
<union-subclass name='LandDAO' table='land'>
<property name='area' column='area'/>
<property name='unitPrice' column='unitPrice'/>
</union-subclass>
</class>
</hibernate-mapping>
Which means in the database i have only 2 tables :
- house (id_property(PK), address, noOfRooms, totalArea, price)
- land (id_property(PK), address, area, unitPrice)
As far as I understood, in this case the ids need to be generated explicitly before calling .save(), so my question is: How can I create a strategy for the automatically generation of the ids, so that the ids from the concrete class form a continuous domain when joined.