Project

General

Profile

Actions

Bug #4773

closed

Wt::Dbo having 2 member item with same class : cannot create a table with 2 member item of same class

Added by Rathnadhar K V almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Target version:
Start date:
02/28/2016
Due date:
03/03/2016
% Done:

0%

Estimated time:
3:00 h

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

Actions #1

Updated by Rathnadhar K V almost 9 years ago

It should be user_home_address in place of user_meeting_address.

Actions #2

Updated by Koen Deforche almost 9 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");
Actions

Also available in: Atom PDF