Casting objects

I have an entity B which inherits from entity A. I now want to create an object B that is an extension of an object already existing in A. But how do I create this object? I am unable to solve it with casting. Am I missing something or can this not be done? Regards, Ronald
2 answers

This is not how inheritance works, an instance of an entity is always a specific type, either of the superentity or one of its subentities. You can't add a specialization to an existing instance of an entity. You could of course create the correct instance and copy all fields and associations.


You can't. You'll have to create a new object of Type B and copy all relevant attributes from your old object of type A. Then delete the old object of type A.