Hi Triley,
I had the same need and have spent a little bit of time on it. I don't have an easy answer for you but possibly a simple workaround. I first tried the metadata route as it seems the most logical. I was going to attempt to do this by getting the collection 'key' column to match with the referenced property column. That wouldn't work in all cases, but seemed reasonable for mine. However, there's something funky with the metadata api. I just couldn't do something as simple as get the key value for the collection mapping. I could get a reference to my collection mapping, but not much else... most of the properties (like getKey()) always came back null.
So if you've done better there, please let me know... I'm really curious what's up.
Anyway, my little workaround has been to simply but my own meta tag under the collection with the value being the name of the property in the referenced class. For example...
<meta attribute="inverse-property">parent</meta>
Then, I can access this at runtime and all is good. If you need more details on how to do that, let me know.
Good luck.
|