[odb-users] cannot compile object view

Boris Kolpackov boris at codesynthesis.com
Fri May 5 06:35:24 EDT 2023


roberto minarelli <roberto.minarelli.de at gmail.com> writes:

> error: view type data member cannot be designated as an object id
> 
> #pragma db view table("Table1") table("Table2")
> struct Tab1_Tab2
> {
>         unsigned long tab1Field;
>         unsigned short tab2Field;
>
>         #pragma db id column(Table1::key) type("VARCHAR2(40)") 
>         std::string tab1_tab2_key;
> };

The `id` specifier does not make sense in a view, only in an object.
So just remove it (along with `columnt(Table1::key)`, which also
doesn't make sense in a table view):

          #pragma db type("VARCHAR2(40)") 
          std::string tab1_tab2_key;

For details on table views, see:

https://www.codesynthesis.com/products/odb/doc/manual.xhtml#10.3



More information about the odb-users mailing list