The information I've read about the "map" construct is that the key
value used in the map is taken from a field in the target entity.  I
have a situation where I need to define a map where the key value is a
column in a join table, not the target table.

Here's an example of the structure I have:

Table FOO:
----------
VARCHAR FOO_ID
INT TYPE

Table FOO_BILLING_INFO:
------------------
VARCHAR FOO_ID
VARCHAR BILLING_SYSTEM
VARCHAR BILLING_INFO_ID

Table BILLING_INFO:
-------------------
VARCHAR BILLING_INFO_ID
VARCHAR BILL_CODE
VARCHAR SYSTEM_NAME

There is a "OneToMany" relationship from FOO to BILLING_INFO.  The "key
value" for the map is intended to be the "BILLING_SYSTEM" value in the
join table.  Also note that the values of "BILLING_SYSTEM" are not the
same as or related to the values for "SYSTEM_NAME" in BILLING_INFO (that
was my first guess).

For each unique value of "FOO_ID" in "FOO", there will be two
"FOO_BILLING_INFO" rows with different "BILLING_SYSTEM" values, and each
of those two rows will point to a "BILLING_INFO" row, sometimes the same
one for both "FOO_BILLING_INFO" rows, but sometimes not.

Reply via email to