cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chad Smith <chadksmi...@gmail.com>
Subject Re: Cayenne 2.0.4 are reverse relationships required
Date Fri, 19 Sep 2008 22:40:20 GMT
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




Mime
View raw message