For 1. yes that would work but only on ORM, not on Infinispan.
It turns out it actually works all the time for Infinispan; at least I think, it took me a while to think of all possible cases but I think I concur with Gustavo; see comments on ISPN-5103: Infinispan uses also a {Transformer} interface which includes a marker for the key type in the key term; so you can figure out which reverse {Transformer}
needs to be applied, and from there it's Id->Entry and being a Cache a Map there is no ambiguity. There are limitations on different cache instances sharing a same index, but then again that's not something we encourage as the Search engine is per-cache.
"incompatible encodings" in 2
I was thinking that at least for some known field bridge implementations that we ship, we could know for example that the output of a DateBridge using an encoding like "01-01-2011" would never have ambiguity with a second type sharing the same index which uses a Long as identifier. We could figure out such a matrix.. not sure if it's worth it so I'd focus on case 1. which seems possibly quite common in practice.
|