AFAIK, Hibernate (the underlying persistence mechanisms) extends your persistence class so that it can "intercept" get/set methods to perform more efficient dirty checking and lazy loading.
So your best bet is:
This might even fail if by chance the object was already in the session, since the actual A class will be returned.
Note this is compliant with the spec since mypack.A$$EnhancerByCGLIB$$4f0ecd01 is actually a subclass of A, thus a is an instance of A.
To do what you want, you can do Hibernate.getClass(a).getDeclaredField()