This really sound like design mistake, because an Object should never change it's class.
I don't know what the real world reason for this desire is, but I try to give some ideas for a potential solution anyway.
How about this setup
Code:
class A{
Set<Role> roles;// a Map might be better here, or a single instance
public <R extends Role> R getRole(Class<R> roleClass){
...
}
}
@inheritance(TablePerConcreteClass)
abstract class Role{
A theA
....}
class B extends Role{...}
class C extends Role{...}
This way every A can provide a B or C orboth, and everything can be mapped with standard Hibernate mappings.