Folks:
Is that possible to have polymorphic association in which a derived class has a different key type?
Example: (from
http://www.developer.com/open/article.p ... _3559931_5)
Listing 7. Table-per-subclass mapping
<class name="Event"table="events">
<id name="event_id"type="long">
<generator class="native"/>
</id>
<joined-subclass name="ConferenceEvent"table="conf_events">
<key column="event_id"/>
...
</joined-subclass>
<joined-subclass name="NetworkingEvent"table="net_events">
<key column="event_id"/>
...
</joined-subclass>
</class>
Now, let's say I need to add a class, say CompositeEvent, in which the primary key is actually a composite key, say String, int, String.
Is there a way to map it using polymorphic association? If so, how? if not so, what is the approach one takes in this case?
I am thinking in terms of having that table map to a event_id; however, have some type of interceptor to tell hybernate to "translate" the single PK on the event table to a 3 piece primary key. Would interceptors be a good way to do that?
Thank you in advance & Regrads,
Harringf