Others have already pointed out that yes you can do 1:N relationships and that you need to tag the Collection and FooLocal accessors. Here's a sample if you need further assistance.
User (id) <-- 1:N --> Phone (userId) UserEJB.java___________________________________________________ /** * @ejb.interface-method * @ejb.transaction type="Supports" * @ejb.relation * name="User-Phone" * role-name="User-has-many-Phones" * cascade-delete="no" */ public abstract Collection getPhones ( ) ; public abstract void setPhones ( Collection phones ) ; PhoneEJB.java___________________________________________________ /** * @ejb.interface-method * view-type="local" * @ejb.transaction type="Supports" * @ejb.relation * name="User-Phone" * role-name="Phones-have-a-User" * cascade-delete="yes" * @weblogic.column-map * foreign-key-column="user_id" * key-column="id" */ public abstract UserLocal getUser ( ) ; public abstract void setUser ( UserLocal user ) ; Also, I noticed that your bean is called "Items". Is that truly the singular form of the bean? Meaning, is there no such thing as an "Item" but only a "collection of items", and a Dictionary holds a "collection of collections of items"? I'm just making sure you didn't name it Items because it is on a many side of a relation. David Harkness Sony Pictures Digital Networks (310) 482-4756 -----Original Message----- From: Milen Dyankov [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 5:18 AM To: [EMAIL PROTECTED] Subject: [Xdoclet-user] One-to-Many CMR Hi all, Is it possible to define one-to-many CMR using XDoclet. 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); // ***** // [snip] // ***** } // end of DictionaryBean =={END OF JAVA CODE}==================================================== 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 (); /** * @ejb.interface-method */ public abstract void setName (String name); // ***** // [snip] // ***** } // end of ItemsBean =={END OF JAVA CODE}==================================================== What I need is Dictionary->name (1) <---> (*) Items->name Currently XDoclet generates "ejb-jar.xml" with One-to-One relationship (which in my opinion is correct). But how can I specify that I want one-to-many. I could'n find the answer for that in XDoclet documentation. Milen ------------------------------------------------------- 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 ------------------------------------------------------- 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
