That code is wrong. With a capital wrong. (WRONG)
Here's a few pointers:
- The table attribute in a collection element (list, in your mappings) refers to a join table. But you've specified the "or" table as both the join table and the entity table. That can never be right.
- You're using the same key and index in each list. That's even wronger (sic).
- You are referring to the OR class via both entity-name="" and class="". That might be legal, but it's redundant (and superfluous).
- You have a polymorphic table that you haven't implemented polymorphically.
Map the OR class as a polymorphic class, using the table per class hierarchy structure (ref docs sectoin 9.1.1), where the discriminator is type,form,flag.
If you really want a list, index = lpos, shared across all OR subclasses, you must use a single <list> in GeneralCollections. You can add getters in your GeneralCollections class that returns sublists of the superclass list, if you feel that having a separate getting per type is a good idea.
If you must have separate properties for each list of ORs, then you must have a separate index column for each one. Or else map each list to a different table.