Wt::Dbo and Polymorphism
Added by Aaron Wright almost 4 years ago
I've been trying to add some persistence to my web application with Wt::Dbo, but I have run up against a problem I can't readily figure out, and that is how polymorphism fits into the equation.
I make use of polymorphism in my web application so that I can treat many objects the same with a common interface. However, I'd like to be able to persist these objects in a database and query for them later by specific type.
I feel like I need a way to tell Wt::Dbo that a class has a collection of base classes, and then somehow all of those object to be persist with unique data per each based on each's derived type (polymorphic persist function?).
I looked through all of the tests and examples for Wt::Dbo and didn't find anything similar. Am I missing something? Or is this not possible?
Replies (2)
RE: Wt::Dbo and Polymorphism - Added by Korneel Dumon almost 4 years ago
Hi,
maybe you can manually call the base class persist method, something like:
template<class Action>
void persist(Action a) {
Base::persist(a);
...
}
RE: Wt::Dbo and Polymorphism - Added by Christian Meyer over 2 years ago
I added a Feature request for Polymorphism
I also want to use it, but it is currently not possible.