[odb-users] is it possible to use same relationship table for 2
class data members ?
boris at codesynthesis.com
Wed Dec 11 00:14:15 EST 2013
Lidia Kalinovsky <lidia at lemur-soft.com> writes:
> #pragma db table("A_bs")
> std::unordered_map<unsigned long, std::shared_ptr<B> , std::hash<unsigned long>> m_bsMap;
> std::vector<std::shared_ptr<B> > m_bs;
> ( i see solution with defining one member as transient and using db
> callback functions to update/load it ).
Yes, this is probably the most straightforward way.
If you have many objects with such containers (or containers of
this template), then it may be better to create your own container
wrapper that maintains the two underlying containers. You can then
add a custom mapping for such a container for ODB. Let me know if
you are interested in this approach and I can provide more details.
More information about the odb-users