[odb-users] One-to-many bidirectional relationship without intermediary table

Mocnik Marko marko.mocnik at lisec.com
Mon Oct 14 09:05:03 EDT 2019


I'm trying to map two tables of the form:

    asdf integer NOT NULL,
    description varchar(500),
    CONSTRAINT testi_pkey PRIMARY KEY (asdf)

    asdf integer NOT NULL,
    qwer integer NOT NULL,
    moredata varchar(100),
    CONSTRAINT pk_testi2 PRIMARY KEY (asdf, qwer),
    CONSTRAINT fk_t2_t FOREIGN KEY (asdf) REFERENCES testi (asdf)

I know that's not pretty, but we have some legacy tables that have this kind of relationship.
Is there any way to map this and if so, how?
The only way I could manage to get a mapping to compile produced a stack overflow when running a query...

Also, is it possible to use two separate headers for testi and testi2?
I could not get this to compile because in one of the files I would need to use a forward declaration instead of a direct include and then the compiler would not find the appropriate template specializations.

Thanks, Marko

More information about the odb-users mailing list