I am using NHibernate to load a large tree of objects of different types. Mapping is implemented using table-per-subclass strategy. I defined a base class "Node" that has only a few fields (NodeId, ParentId, NodeType) and several subclasses that inherit from Node and add their own fields.
The implementation of this approach was straightforward and I can't complain about performance. A large tree of 10 000 objects of different types is populated on my old machine within a few hundred millisedonds using a single roundtrip. However, there is one thing that worries me: such strategy results in generation of a complex query where Node table is outer joined with every other table corresponding to defined subclasses. While this is fine when the number of different subclasses are small, in case the number grows, the OUTER JOIN complexity will increase too.
Defining table per class seems to be not an elegant option, and it will work slow when selecting data from a base class (because of UNION). Other options seem to increase the number of roundtrips to the database server.
So what do you think is a best practice when populating a large tree consisting of entities of different types? Is there anything better than table per-cublcass?