Casting objects

0
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
asked
2 answers
3

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.

answered
1

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.

answered