You could do something like
MyClass myObj = pm.getObjectById(MyClass.class, theIdValue);
This would likely work whether you are using (single-field) application identity OR datastore identity. And you don't need to cast anything ...
Works perfectly. Didn't realize that the solution was that straightfoward. I had understood from the javadoc that the `theIdValue` had to be an Identity object.