hi all, I have some problems with value objects.

so here is the example:
Company with two type of addresses.

like the example here
http://xdoclet.sourceforge.net/xdoclet/valueobjects.html
i consider the address to be composition. It can be an aggregation too, but
composition fits my case.

so here is my source:


...

        /**
         * @return address for correspondence
         * @ejb.relation
         * name = "companyInfo-addressCor-1-1"
         * role-name = "companyInfo"
         * target-ejb="Address"
         * target-role-name="addressCor"
         * target-cascade-delete="yes"
         *
         * @ejb.interface-method
         * view-type="local"
         *
         * @jboss.relation
         * related-pk-field="addressId"
         * fk-column="address_Cor_id"
         *
         * @ejb.value-object
         *  compose="com.leasing.business.AddressValue"
         *  compose-name="AddressCorValue"
         *  relation="external"
         *
         */
        public abstract AddressLocal getAddressCorLocal();

        /**
         * @param address
         *  @ejb.interface-method
         *      view-type="local"
         *
         */
        public abstract void setAddressCorLocal(
                        AddressLocal addressCorLocal);

        /**
         * @return registration address
         * @ejb.relation
         * name = "companyInfo-addressReg-1-1"
         * role-name = "companyInfo"
         * target-ejb="Address"
         * target-role-name="addressReg"
         * target-cascade-delete="yes"
         *
         * @ejb.interface-method
         * view-type="local"
         *
         * @jboss.relation
         * related-pk-field="addressId"
         * fk-column="address_Reg_id"
         *
         * @ejb.value-object
         *  compose="com.leasing.business.AddressValue"
         *  compose-name="AddressRegValue"
         *  relation="external"
         *
         */
        public abstract AddressLocal getAddressRegLocal();

        /**
         * @param address
         *  @ejb.interface-method
         *      view-type="local"
         */
        public abstract void setAddressRegLocal(
                        AddressLocal addressRegLocal);

...

Difference between that and EmployeeBean Sample of xdoclet is in fact only
that i Use compose instead of aggregate.
But the generated code have errors:

here is the CompanyInfoCMP:

...
          // Anonymous block to allow variable declations without conflicts
          {
        // Checks for null composition
        if (valueHolder.getAddressCorValue() != null)
        {
                 java.lang.Integer pk = 
valueHolder.getAddressCorValue().getAddressId();

                 com.leasing.business.AddressLocalHome home =
com.leasing.business.AddressUtil.getLocalHome();

                 com.leasing.business.AddressLocal relation = 
home.findByPrimaryKey(pk);
                 relation.setAddressCorValue(valueHolder.getAddressCorValue());
        }
          }
          // Anonymous block to allow variable declations without conflicts
          {
        // Checks for null composition
        if (valueHolder.getAddressRegValue() != null)
        {
                 java.lang.Integer pk = 
valueHolder.getAddressRegValue().getAddressId();

                 com.leasing.business.AddressLocalHome home =
com.leasing.business.AddressUtil.getLocalHome();

                 com.leasing.business.AddressLocal relation = 
home.findByPrimaryKey(pk);
                 relation.setAddressRegValue(valueHolder.getAddressRegValue());
        }
          }
...

and the problem:

AddressLocal interface didn't have method setAddressCorValue neither
setAddressRegValue. Only setAddressValue.
so i think that setAddressValue will be ok for me.

Thaks in advance for your answers.
Petko.








---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17.9.2004 a.




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to