[odb-users] How to handle hierarchical class structure

Michael Powell mwpowellhtx at gmail.com
Sat Apr 20 09:29:18 EDT 2013


Hello,

How is ODB at handling a hierarchical class model? For instance,
forgiving the psuedo code, I am using boost and have a couple of
classes with boost-ish concerns folded in:

class model_base {
private:
  friend class odb::access;

public:

  #pragma db id
  boost::uuid id;

protected:
  model_base(){}

public:
  virtual ~model_base() {}
};

Then we extend that into the model space:

#pragma db object
class point : public model_base {
public:

  float _x, _y;

public:
  point() : model_base(), _x(0), _y(0) {}
};

#pragma db object
class shape : public model_base {
public:
  point _point;

public:
  shape : model_base(), _point() {}
};

And so on.

So, generally, what ODB outcome to expect? Do we end up with flat
separated tables? Or does more of an effort to normalize the database
take place? How clean of a db separation of concerns is it (for the
programmer-sensitive db admins out there...).

Thank you...

Regards,

Michael Powell



More information about the odb-users mailing list