Is it possible to specify a data structure where the hierarchy is the
same table?  For example, a bill of material has "parts" contain other
parts, but all the parts are still in the same table.  I tried to
specify the dbo class as shown below, but that causes the program to
crash when session::createTables() is called.  Is there a way to do
this?
Also, is is possible to place a NULL value in the database using wt::dbo?

#include <Wt/WString>
#include <Wt/Dbo/Types>
#include <Wt/Dbo/WtSqlTraits>

class Part;
namespace dbo = Wt::Dbo;
class Part : public dbo::Dbo {
 public:
   dbo::ptr<Part>      parent;
   std::string         refdes;
   std::string         value;

   template<class Action>
   void persist(Action& a) {
       dbo::belongsTo(a, parent,       "part");
       dbo::field(a, refdes,           "refdes");
       dbo::filed(a, value,            "value");
   }
};
DBO_EXTERN_TEMPLATES(Part);

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to