> Is it possible to define one-to-many CMR using XDoclet.

Yes, as the other responder said.

> I have dictionary bean:
>
> =={JAVA CODE}========================================================
> /**
>   *  @ejb.bean
>   *      name = "Dictionary"
>   *      type = "CMP"
>   *      cmp-version = "2.x"
>   *      view-type = "local"
>   *      schema = "Dictionary"
>   *
>   */
>
> public abstract class DictionaryBean implements javax.ejb.EntityBean {
>
>    /**
>     *  @ejb.persistence column-name = "name"
>     *  @ejb.interface-method view-type = "local"
>     *  @ejb.pk-field
>     *  @ejb.relation
>     *      name = "Dictionary-Items"
>     *      role-name = "Dictionary-has-Items"
>     *      cascade-delete = "yes"
>     */
>    public abstract String getName ();
>
>    /**
>     *  @ejb.interface-method view-type = "local"
>     *
>     */
>    public abstract void setName (String name);

Why are you defining a relationship between Dictionary and Item on the 
accessor for "name" ?

You need to have the accessor for "items"
public abstract Collection getItems();

and define the relationship in the javadoc header for that method. The 
accessor for the attribute that you need is always the place to define the 
relationship for it.


> and Items bean
>
>
> =={JAVA CODE}========================================================
> /**
>   *  @ejb.bean
>   *      name = "Items"
>   *      type = "CMP"
>   *      cmp-version = "2.x"
>   *      view-type = "local"
>   *      schema = "Items"
>   */
> public abstract class ItemsBean implements javax.ejb.EntityBean {
>
>      /**
>       *  @ejb.persistence column-name = "name"
>       *  @ejb.interface-method
>       *  @ejb.relation
>       *      name = "Dictionary-Items"
>       *      role-name = "Item-in-Dictionary"
>       */
>      public abstract String getName ();

Again, you are defining the relationship in the wrong place for XDoclet. Add 
an accessor for the dictionary
public abstract DictionaryLocal getDictionary();
and define the relationship in its header javadoc.



HTH
-- 
Andy


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to