Dear experts,
For a certain requirement in HR, I'm trying to create a cross-BO association based on an alternative key, which consists of two attributes.
According to How to Create Alternative Keys with BOBX, I created a structure containing the attributes of the alternative key: Cf. the remark on page 5: If the semantical identifier consists of more than one attribute create a structure containing the attributes of the alternative key. Take care to use the same names and data types for the attributes as in the persistent structure. The name of the Alternative Key must be different of the names of the node attributes
For example, in my referenced BO I have a persistent structure which contains the following attributes:
KEY | 1 Type | /BOBF/CONF_KEY |
PARENT_KEY | 1 Type | /BOBF/CONF_KEY |
ROOT_KEY | 1 Type | /BOBF/CONF_KEY |
.INCLUDE | 1 Type | ZZS_PERSON_D |
PERSON_OBJID | 1 Type | HROBJID |
PERSON_OTYPE | 1 Type | OTYPE |
COMPANY_NAME | 1 Type | STEXT |
and a alternative key structure for the alternative key named "PERSON_ALT_KEY" containing:
PERSON_OBJID | 1 Type | HROBJID |
PERSON_OTYPE | 1 Type | OTYPE |
1. Is it possible to create this cross-BO association via binding?
From the source code I'm not really sure, since the part of internal ticket 0000057141 2014, which should raise the exception, is commented:
2. Since the first option doesn't seem to work for me, I guess we have to implement this binding using an association class. There, I can do a query_by_attributes on my referenced BO and retrieve the key.
But... My referenced BO is based on a DAC which uses a model class to retrieve the person (student / central person / etc) by alternative keys objid and otype; and uses transient keys. In a later phase, that transient key is used to access the referenced BO, but then, the DAC / model of the referenced BO does no longer know this transient key.
What would be your recommendation in solving this issue?
One solution could be to extend the model class, so that the singleton instance can also be retrieved by transient keys, by saving the transient keys in a static attribute. Are there any alternatives?
Many thanks in advance!
Kind regards,
Bjorn