My guess, having upgraded over 90 classes from SS3 to SS4 recently is to check that you have also “upgraded” the Data associated with your page or data object class.
Don’t forget to also add:
private static $table_name = ‘MyClass’;
to every Page and DataObject so that the NameSpacing doesn’t ruin your database. Although if you do forget it’s easy to fix. Just delete the extra tables in the DB.
This SQL should do an upgrade for a Page Type class:
UPDATE `SiteTree` SET `ClassName` = 'My\\Website\\MyClassHolder' WHERE `ClassName` = 'MyClassHolder';
UPDATE `SiteTree_Live` SET `ClassName` = 'My\\Website\\MyClassHolder' WHERE `ClassName` = 'MyClassHolder';
UPDATE `SiteTree_Versions` SET `ClassName` = 'My\\Website\\MyClassHolder' WHERE `ClassName` = 'MyClassHolder';
This sql for a DO class (non versioned SS3 DO):
UPDATE `MyClass` SET `ClassName` = 'My\\Website\\MyClass' WHERE `ClassName` = 'MyClass';
Where My\Website\ is the Namespace you are using.
Then run /dev/build/?flush
The CMS should pick it all up again and your Live and Stage copies will be there and any Versioned data.