Can I get hibernate to put the list index into entities within the list? Or even better, can I put the nesting entity into the nested entity (allowing me to use getList().indexOf(this))? Consider this mapping fragment:
Code:
<class name="configuration" ...>
...
<list name="routers" ...>
<key column="ConfigID"/>
<list-index column="ConfNum"/>
<many-to-many column="RouterID" class="Router"/>
</list>
...
</class>
What has to be in the Router class to allow it to know about the configuration
when it is loaded via this list. If it is loaded independently, then the configuration details would be unknown (null configuration entity, or ConfNum = -1 if that's all I can work with). I don't want to put a full-fledged bidriectional mapping in Router, because a router's configurations mean nothing to it in my data model: all that makes sense is a configuration as it applies to a router.
At the moment I'm putting a reference to the configuration into the router in business logic after it's loaded. It's working fine, but it has to be done in the 5 or 10 busniess logic methods that load configurations, and I can see it becoming a maintenance issue in the future.