|
I'm using the hbm2ddl Ant task to generate the DDL for my entities. I have several entities that are using an inheritance type of JOINED. I know Hibernate does not require the DiscriminatorColumn annotation so have purposely omitted this. However, when I generate the DDL using the Ant task I do not see the primary key columns or foreign key constrains for the subclassed entities.
For example, I have the standard Employee and FTEmployee sample. The Employee entity is an abstract class and has inheritance set to JOINED. FTEmployee extends Employee. When I generate the DDL the FTEmployee table only features the attribute columns and not the PK. In fact, the PK column and FK constraint are not created until I run up the application (assuming hbm2ddl.auto is set correctly). Even then I do not see any DDL being issued (like, "ALTER TABLE...") when show_sql is set to "true".
Is this by design? If the generated DDL is not complete then what is the point of it? I would expect the full DDL to be generated, including all columns, all constraints and all indexes, so that I could create the database without having to execute the application. Also, creating a table without a PK is just wrong, isn't it? Or have I missed something?
Thanks in anticipation.
|