Hi all,
 
I'm getting a bit confused with implementing my database design with ejb CMR and xdoclet.
I have two beans A and B. Each of these beans have an address that I want to factor out into
AddressEJB.
 
So I want it so that bean A and AddressEJB is 1-1,
and bean B and AddressEJB is also 1-1.
 
I think the right way to do this is making the relationships unidirectional, ie, either A or B can
get back their AddressEJB, but the Address can't get back it's bean A or B. I think this is the
right way to do it because otherwise the AddressEJB would have to have a get method for both
A and B. However I'm not sure if it can be done at all.
 
I'd love some advice as to whether I'm going along the right way or not. Here's what I'm thinking
about in terms of my xdoclet code.
 
 
Example of my xdoclet code for bean A.
 
 
    /**
     * @ejb.interface-method
     * @ejb.relation
     *      name="abean-address"
     *      role-name="abean-has-address"
     *      target-ejb="Address"
     *      target-role-name="address-belongs_to-abean"
     *      target-cascade-delete="yes"
     * @jboss.relation
     *      fk-column="addressId_fk"
     *      related-pk-field="addressId"
     */
    public abstract AddressLocal getAddress();
    public abstract void setAddress( AddressLocal address );
 
 
thanks very much,
Brian

Reply via email to