Title: RE: OR Mapping

The relation between AccountOwnerEJB and AccountOwner, using EJB 2.0, would look like this:

in AccountOwnerEJB you would have the methods:

        public abstract Collection getAccounts();

        public void addAccount(Account account) throws RemoteException
        {
                this.getAccouts().addAccount();
        }
       
        ...

Notice that the 'public static final Class accounts_type = Account.class;' is gone.
For the cmp-fields you just have abstract get/set methods.
For methods manipulating your cmp-fields you implement methods that relies on the abstract get/set methods.

In the descriptor for AccountOwnerEJB you would have:
        <entity>
                ...
                <cmp-field><field-name>accounts</field-name></cmp-field>
                ...
        </entity>

You would then specify your relation inside the <relationships> tag,
        <relationships>
                <ejb-relation-name>accountowner-account</ejb-relation-name>
                <ejb-relationship-role>
                        <ejb-relationship-role-name>accountowner-has-accounts</ejb-relationship-role-name>
                        <multiplicity>one</multiplicity>
                        <role-source><ejb-name>com.acme.atm.ejb.AccountOwner</ejb-name></role-source>
                        <cmr-field>
                                <cmr-field-name>accounts</cmr-field-name>
                                <cmr-field-type>java.util.Collection</cmr-field-type>
                        </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                        <ejb-relationship-role-name>account-belongsto-accountowner</ejb-relationship-role-name>
                        <multiplicity>many</multiplicity>      
                        <role-source><ejb-name>com.acme.atm.ejb.Account</ejb-name></role-source>
                </ejb-relationship-role>
        </relationships>
               

Magnus Rydin
WebTeknik AB.ejb.AccountOwner
[EMAIL PROTECTED]





> -----Original Message-----
> From: Vidur Dhanda [mailto:[EMAIL PROTECTED]]
> Sent: den 2 juli 2000 04:10
> To: Orion-Interest
> Subject: OR Mapping
>
>
> Hello,
>
> I'm trying to experiment with the OR mapping features of Orion.  I'm
> quite new to this topic and can't understand how to specify a mapping.
> Could someone post an example or hints to get me started.
>
> Thanks,
> Vidur
>
> PS.  If possible, please also cc me.
>
>

Reply via email to