Re: Cayenne 2.0.4 are reverse relationships required

From: Chad Smith (chadksmith..mail.com)
Date: Fri Sep 19 2008 - 18:40:20 EDT

  • Next message: Chad Smith: "Re: Cayenne 2.0.4 are reverse relationships required"

    I need to provide some background: I have a web app (Spring+Cayenne)
    which has been modularized so that functionality can be added or removed
    w/ as little effort as possible.

    Lets say for example, that I have a module called core that has an
    address table which I would like to make available to all the other
    modules but I don't want the address table or its domain object to know
    anything about the other modules. So here is the address table ...

    Address
    ------------------------
    adress_id
    street_1
    street_2
    city
    state
    postal_code
    country

    ... and here is a table in another module that would like to use the
    "core" Address functionality ...

    Customer
    -----------------------
    customer_id
    first_name
    last_name
    ...
    shipping_address_id
    billing_address_is

    So that I don't have a dependency from the core module you can see that
    the relationship will only be one way from customerToAddress.
    (address.address_id -> customer.shipping_address_id, etc). I don't want
    the reverse relationship b/c then there will be a reference (in the
    mapping xml) from core to an addon module.

    This seems to work OK when I store the object. The
    customer.shipping_address_id (and billing_address_id) fields are
    populated in the database. However, when I try to access the billing
    address (via customer.getCustomerToBillingAddress()) method, an address
    object is returned, however, all the values are null. I'm wondering if
    this due to the lack of a reverse relationship?

    TIA
    Chad



    This archive was generated by hypermail 2.0.0 : Fri Sep 19 2008 - 18:40:57 EDT