Not only it'll work but that's the (simplest) way to make it work.
Alternatives involve using wrappers/builders. I've also seen people using EntityProxy
s where the stringified value is used as the identifier, but beware that RequestFactory requires a per-request cache.