Bug #4773
closedWt::Dbo having 2 member item with same class : cannot create a table with 2 member item of same class
0%
Description
Namasthe,
class address
{
Wt::WString address_line1;
Wt::WString address_line2;
Wt::WString address_line3;
template
void persist(Action& action)
{
Wt::Dbo::field(action, address_line1, "address_line1");
Wt::Dbo::field(action, address_line2, "address_line2");
Wt::Dbo::field(action, address_line3, "address_line3");
}
};
class user
{
private:
address home_address;
address office_address;
template
void persist(Action& action)
{
user_office_address.persist(action);
user_meeting_address.persist(action);
}
};
If I try connection->createTables() with above class (suitably mapclassed)..then dbo object throws an exception.
Perhaps the createTable is trying to create 2 columns with same name (eg: address_line1, address_line2, address_line3)...
This is a critical bug. This needs to be resolved. I should have ability to create class items from an another class any number of times.
Regards
Rathnadhar K V
Updated by Rathnadhar K V over 8 years ago
It should be user_home_address in place of user_meeting_address.
Updated by Koen Deforche over 8 years ago
- Status changed from New to Closed
You are adding trying to define two fields with the same name. How would you expect that to work?
What you should do is change your code so that you can prefix each of the 'embedded objects':
user_office_address.persist(action, "office");
user_meeting_address.persist(action, "meeting");