You've touched on something interesting here - a problem which many of us face I think.
Let me address this in two parts:
1. How to make the current table-per-subclass model more manageable:
- use views to create the artificial "tables" of primary keys; for example, we have an interface (much like your Task) which is implemented by many mapped classes; we have a view which aggregates all the primary keys (and other properties of the interface) using the UNION keyword.
2. The "any" association type
- try the "any" association type; the shortcoming of this is that you can not do "polymorphic" joins or queries on properties mapped using "any". So for example, if you have a table for Assignments of your Tasks, with a column for taskID, and taskType (required by "any" mapping), it will load and instantiate the appropriate Task, but you can not search your Assignments by Task SUBproperties, as this would require multiple joins which you're trying to avoid (and which is not implemented).
Regardless of the limitations of this, I believe the "any" mapping is what you're looking for when you mention "foreign key type". Have a look here for more:
http://www.hibernate.org/hib_docs/nhibe ... tance.html
Any feedback or confirmation from developers would be greatly appreciated.
Thanks,
-Sasha Borodin