Sathya Sekar penned

I've only used WebLogic, though I think this makes no difference in this
case. True, the tags are different. For example, I put this on the
getUser() method of my Address bean (User <-1--N-> Address) with no
WL-specific tags for the User bean's getAddresses() accessor.

   * @weblogic.column-map
   *      foreign-key-column="user_id"
   *      key-column="id"

> I want to establish a self-referencing CMR - for
> example, employee-manager CMR. I have a field
> managerId in the entity. The CMR is to get a list of
> all employees reporting to that manager :

Since managerId is the FK field for the CMR, mapping it as a CMP field
is unnecessary and can only be done (at least for WebLogic, though it
should be universal) for the getter. The CMR manages the setting of the
value. It doesn't look like this is the problem, but I got errors from
WebLogic when I tried mapping the setter.

>       /**
>        * @ejb.interface-method
>        *
>        * @ejb.relation
>        *              name = "managers-employees"
>        *              role-name = "manager"
>        *              target-ejb = "Employee"
>        *              target-role-name = "reporting-group"
>        *
>        * @jboss.relation
>        *              related-pk-field = "managerId"
>        *              fk-column = "mgrid"

Isn't the PK field for Employee "id"? If so, "related-pk-field" should
be "id" (the CMP field name, not the column name in the database.

>        * @jboss.target-relation
>        *              related-pk-field = "id"
>        *              fk-column = "id"

I believe this is where "managerId" (though the database column name in
this case) goes here for "fk-column".

>        * @ejb.value-object
>        *              relation = "external"
>        *              aggregate = "test.interfaces.EmployeeValue"
>        *              aggregate-name = "reports"
>        *              members = "test.interfaces.EmployeeLocal"
>        *              members-name = "reports"
>        *              type = "java.util.Collection"
>        *
>        * @return
>        */
>       public abstract Collection getDirectReports();

Stefan Champailler just posted a document on Monday regarding
self-referencing value objects. I don't use XDoclet VOs, so I don't know
if this construct will be okay. If you have trouble after deploying the
bean succesfully, I suggest you take a look at it.

-- 
David Harkness                               Sony Pictures Digital
Sr. Software Engineer   310.482.4756    [EMAIL PROTECTED]

        Those who judge the value of advice by its source
        will at once dismiss the best and follow the worst.


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to