Hi all,

I'm trying to get my Value-Object pattern based application to work.
So far I have not been succesful. I hope you guys can help me, or push me 
into the right direction.

I have two classes. Advertisement and Correction which relate like this:

+-------------+                      +----------+
|Advertisement|-1-----------------*->|Correction|
+-------------+                      +----------+

So an Advertisement can have zero or more Corrections (1:N).


In my Advertisement CMP bean I coded:

-----------------------------------------------------------------
 * @ejb.ejb-ref 
 *              ejb-name = "Correction"
 * @ejb.value-object 
 *              name = "Advertisement"
 *              match = "*"
 */
public abstract class AdvertisementEJB implements EntityBean {
    // etc....

    /** 
     * @ejb.interface-method view-type="local"
     * 
     * @ejb.relation
     *    name="Advertisement-Correction"
     *    role-name="Advertisement-has-many-Corrections"
     *    target-cascade-delete="yes"
     *    target-ejb="Correction"
     *    target-role-name="Correction-belongs-to-Advertisement"
     *    target-multiple="no"
     * @jboss.relation-mapping style="foreign-key"
     * @jboss.target-relation
     *      fk-constraint="false"
     *      fk-column="serial"
     *      related-pk-field="serial"
     * @ejb.value-object 
     *          
aggregate="ordermanager.advertisement.valueobjects.CorrectionValue"
     *          aggregate-name="CorrectionValue"
     *          members="ordermanager.advertisement.ejb.CorrectionLocal"
     *          members-name="CorrectionValue"
     *          relation="external"
     *          type="Collection"
     */
        public abstract Collection getCorrections();
        public abstract void setCorrections(Collection corrections);
------------------------------------------------------------------


In my Correction CMP bean, I coded:
------------------------------------------------------------------
 * @ejb.value-object 
 *              name = "Correction"
 *              match = "*"
 */
public abstract class CorrectionEJB implements EntityBean {
------------------------------------------------------------------

Now in my Client application i'm trying to do the following:

------------------------------------------------------------------

// lookup a Manager Session Facade bean
AdvertisementManagementHome managerHome = 
        (AdvertisementManagementHome) PortableRemoteObject.narrow(
                ctx.lookup("ejb/advertisement/AdvertisementManagement"), 
                AdvertisementManagementHome.class);
 
// create the manager 
AdvertisementManagement manager =
        managerHome.create();


// create an AdvertisementValue Object:
AdvertisementValue valueObj = new AdvertisementValue("a_test_id");
valueObj.addCorrectionValue(new CorrectionValue("a_test_correction"));

// create the Advertisement
manager.addAdvertisement(valueObj);
-----------------------------------------------------------------------

This does not work, I get an 'CorrectionLocal not Bound' exception.

I suspect something is wrong with my relations... 
Can somebody help???

Many Thanks,

Harm de Laat
Informatiefabriek
The Netherlands









-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? 
You could win a Tablet PC. Get a free Tablet PC hat just for playing. 
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to