I'm trying to map several classes with an abstract base class in one table, and several subclasses, some of which have their own table.
The classes look roughly like this:
abstract class Base;
abstract class ABase : Base;
class A1: ABase;
class A2: ABase;
abstract class BBase : Base;
class B1 : BBase;
class B2 : BBase;
There is a table for Base, a table for ABase and its descendants, and a table for BBase and its descendants, and several more sets of classes and tables following in that pattern.
My mapping uses a <class/> for Base, with a discriminator column, and <subclass/> for the others, with the extra tables pulled in via <join/> in the subclass.
The mapping works, but I'm running into a snag trying to do some performance tuning. I set the <join> items to fetch="select", since in any given query of Base, the entities returned are commonly only of one or two types, so joining all the other tables was slowing things down.
The select fetch strategy improved things, but I'd like to be able to batch fetch several items at once. It seems like this would naturally be done by setting batch-size="10" or so on the <subclass/> -- what it does on a simple <class/> is exactly what I'd like to do for me here. However it's not legal on a subclass, and I'm not sure even if it was, if that would carry over to the join.
Any suggestions on how I might get it to do the batch queries for my subclass tables?
|