Let's assume that there is a table named Setting:
Based on this table is a flat inheritance hierarchy designed, with "category" as the class discriminator
- Setting as a top class (category = 'X'); includes columns: id, name, category
- SettingText: category = 'T'; includes column: text_value
- SettingInt: category = 'I'; includes column: int_value
There is an existing object - SettingText. I would like to change it to SettingInt. From the database point of view it's easy: just set category = 'I' (I know that I loose the text_value column content). But how to do it using ORM mechanisms? I can't just cast SettingText to SettingInt. Deleting the old object and creating a new one is not always possible (it may be an FK somewhere). Have you got any suggestions?