I have a C parent class and a PC child class which adds temporary metadata. I want to persist PCs as Cs (discarding the extra data from PCs). Despite casting, eBean outsmarts me and figures out that it really has a PC, not a C. What is the best way to address this situation?
Some things I've considered:
- Making a "toC" method in PC, which makes a fresh instance of C. This will make updates to C dangerous, though, as they'll require updates to "toC".
- Use reflection in some way to copy all of the fields in PC to a fresh C.
- Tell eBean that it should persist all PCs as Cs. I can't figure out how to do this.
Thanks for any insight.