I'm looking at adding the reverse engineering of table per subclass inheritance from the DB and I'd like some feedback on my plan.
1) If automatic feature is on, then if a table has column that is a PK and FK then consider it a subclass of the table referenced by the FK.
2) Add isSubclassDerivationKey attribute to the <foreign-key> element of reveng.xml. If present, used to override automatic setting or to set true when automatic setting is off.
3) Modify JDBCBinder.createPersistentClasses to create subclasses as appropriate using #1 and #2 above.
4) Modify EntityPOJOClass to add
generateInheritanceAnnotation()
generatePrimaryKeyJoinColumnAnnotation()
5) Modify pojo/Ejb3TypeDeclaration.ftl to take advantage of new methods in #4.
6) Not sure how hbm2hbmxml needs to be changed.
I'd like to implement this as a patch to the tools. If that is acceptable, I'll add a JIRA.
Thanks,
Martin
|