Hello, Pascal Kesseli wrote:
> How would I implement an aggregation or composition between two classes > in SOCI? If class A has a field of Class B, I would like SOCI to store a > foreign key to B in A. Can this be automatically achieved with SOCI No, this is not possible. At best you might try some smart use of the ORM features with user coversion defined for class A and queries against a stored procedure that does the rest of the trick (foreign keys), but I do not think that this would be very maintainable in the long term. Note also that a natural extension of this use-case is class A that has a list of Bs, where the above approach would not work. > or > should I associate these keys manually (which seems perfectly possible > as well)? This is the recommended option. Please note that SOCI is not a full-featured ORM platform, but rather a data-structure-agnostic solution for database interactions. On one hand, this might be limiting, as in your simple case of class A referring to class B. One the other hand, this might be liberating when data structures become more elaborated. Regards, -- Maciej Sobczak * www.msobczak.com * www.inspirel.com ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Soci-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/soci-users
