I have a situation where an account can have one or none of an another
entity bean in a relationship.

I've defined it below as a one-one relationship.  This works fine if the
billingInfo exists, but if it doesn't and I call getBillingInfo from the
account, I still get an EntityBean Interface back.  (No Exception
occurs)  Then, when I try to access or set something on the billingInfo
interface, I get NoSuchEntityException from jboss.

Should I use one-many instead??  Shouldn't I get null back or something
instead of an interface to the ejb when the billingInfo doesn't yet
exists?  If this is the correct functionality, then how to I know if a
billing info record exists or not yet?  Is it possible to remove the
billingInfo record in this case or is that against the law in a one-one
relationship?

Thanks for any comments.
Dennis

<ejb-relation>
            <description>One Account has One/None
BillingInfo</description>
            <ejb-relation-name>Account-BillingInfo</ejb-relation-name>
            <ejb-relationship-role>
               
<ejb-relationship-role-name>AccountToBillingRole</ejb-relationship-role-name>
                <multiplicity>One</multiplicity>
               
<relationship-role-source><ejb-name>AccountEJB</ejb-name></relationship-role-source>   
             
                <cmr-field>
                    <cmr-field-name>billingInfo</cmr-field-name>
                </cmr-field>                
            </ejb-relationship-role>
            <ejb-relationship-role>
               
<ejb-relationship-role-name>BillingToAccountRole</ejb-relationship-role-name>
                <multiplicity>One</multiplicity>
                <relationship-role-source>
                    <ejb-name>BillingInfoEJB</ejb-name>
                </relationship-role-source>                
            </ejb-relationship-role>
        </ejb-relation>




Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to