So I have a rather complex mapping I'm trying to accomplish. I have an object ("message") that can contain multiple children ("attributes") in a one-to-many relationship. The children represent an extent or system of subclasses. So there's BaseAttribute, FooAttribute, BarAttribute, etc. There can be zero to many of each kind of attribute associated with the message, but at most one of any instance. This hierarchy of attributes is meant to be extensible, so I want to be able to add new attributes at a later date. Right now the hierarchy consists of ~20 kinds of attribute.
I've got this somewhat modeled using joined-subclass and one-to-many. It creates an outer-join from hell (as I expected). I chose the joined-subclass since it seems to leave open the possiblity of adding more attributes in the future by simply adding more tables.
Now I'm trying to figure out how to query. Naturally I want to query for messages based on the various attributes. The FAQ question "How do a write a query that returns objects based upon a WHERE clause condition applied to their collection elements?" is close to what I want, but it doesn't deal with the fact that my collection is polymorphic.
So I guess I have two questions: 1. Like the FAQ question cited, but for polymorphic collection elements. 2. Any better ideas on how to do my mapping?
Thanks much
|