I can't tell from the code you posted.  Are you setting the relationships in 
the ejbPostCreate or ejbCreate.  I was having problem with relationships 
untill I started setting them in ejbPostCreate.

Jason

On Tuesday 01 July 2003 06:52 am, Arvin Arora wrote:
> Dear XDoclet experts,
>
>
>
> after mastering the creation of 1:N relations with Xdoclet (eclipse /
> lomboz / Jboss 3.07) I would like to use the generated EJBs through
> Value Objects. As a prototype case I have Customers each of which can
> have N Projects.
>
>
>
> What works:
>
> + Create EJBs and Value Objects
>
> + Access and create Customers through Value Objects
>
> + Create set / getProjects for Customer and CustomerValue
>
>
>
> What does not work:
>
> + Create properly functioning set / getCustomer for Project
>
> + Create set / getCustomer for Project Value
>
>
>
> I guess what's behind is to correctly assign the relationship and FK /
> PK definition on the Project Bean side with the corresponding getters /
> setters. I tried different variants (e.g. with set / getCustomerNumber
> which is the FK colum) but they did not work.
>
>
>
>
>
> Here is my sourcecode for the CUSTOMER BEAN:
>
>
>
> /**
>
>  * @ejb.bean name="Customer"
>
>  *    jndi-name="CustomerBean"
>
>  *  local-jndi-name="CustomerBeanLocal"
>
>  *    type="CMP"
>
>  *  primkey-field="number"
>
>  *  schema="myCustomerSchema"
>
>  *  cmp-version="2.x"
>
>  *
>
>  * @ejb.persistence
>
>  *  table-name="customer"
>
>  *
>
>  * @ejb.finder
>
>  *    query="SELECT OBJECT(a) FROM myCustomerSchema as a"
>
>  *    signature="java.util.Collection findAll()"
>
>  *
>
>  * @ejb.value-object
>
>  *   name="Customer"
>
>  *   match="*"
>
>  *
>
>  */
>
>
>
> public abstract class CustomerBean implements EntityBean {
>
>
>
>       /**
>
>        * The  ejbCreate method.
>
>        *
>
>        * @ejb.create-method
>
>        */
>
>       public java.lang.Integer ejbCreate(String name) throws
> javax.ejb.CreateException
>
>       {
>
> ...
>
>       }
>
>
>
>       /**
>
>        * The container invokes this method immediately after it calls
> ejbCreate.
>
>        *
>
>        */
>
>       public void ejbPostCreate(String name) throws
> javax.ejb.CreateException
>
>       {
>
>       }
>
>
>
>       /**
>
>       * Returns the number
>
>       * @return the number
>
>       *
>
>       * @ejb.persistent-field
>
>       * @ejb.persistence
>
>       *    column-name="number"
>
>       *     sql-type="int"
>
>       * @ejb.pk-field
>
>       * @ejb.interface-method
>
>       */
>
>       public abstract java.lang.Integer getNumber();
>
>
>
>       /**
>
>       * Sets the number
>
>       *
>
>       * @param java.lang.Integer the new number value
>
>       *
>
>       * @ejb.interface-method
>
>       */
>
>       public abstract void setNumber(java.lang.Integer number);
>
>
>
> ... (other getters / setters)
>
>
>
>       /**
>
>       * Defines the relation to 0..N projects.
>
>       *
>
>       * @ejb.relation
>
>       *  name="Customer-Projects"
>
>       *  role-name="customer-has-projects"
>
>       *
>
>       * @ejb.value-object
>
>       *  compose="neo.pps.model.projects.ProjectValue"
>
>       *  compose-name="ProjectValue"
>
>       *  members="neo.pps.model.projects.ProjectLocal"
>
>       *  members-name="Project"
>
>       *  relation="external"
>
>       *  type="Collection"
>
>       *
>
>       * @ejb.interface-method view-type="local"
>
>       */
>
>       public abstract Collection getProjects();
>
>       /**
>
>       *
>
>       * @ejb.interface-method view-type="local"
>
>       */
>
>       public abstract void setProjects(Collection projects);
>
>       /**
>
>       *
>
>       * @ejb.interface-method
>
>       */
>
>       public abstract CustomerValue getCustomerValue();
>
>       /**
>
>       *
>
>       * @ejb.interface-method
>
>       */
>
>       public abstract void setCustomerValue(CustomerValue value);
>
>
>
>
>
> ... and for the PROJECT BEAN:
>
>
>
> public abstract class ProjectBean implements EntityBean {
>
>
>
>       /**
>
>        * The  ejbCreate method.
>
>        *
>
>        * @ejb.create-method
>
>        */
>
>       public java.lang.Integer ejbCreate(String name) throws
> javax.ejb.CreateException
>
> {
>
> ...
>
>       }
>
>
>
>       /**
>
>        * The container invokes this method immediately after it calls
> ejbCreate.
>
>        *
>
>        */
>
>       public void ejbPostCreate(String name) throws
> javax.ejb.CreateException {
>
>       }
>
>
>
>       /**
>
>        * The  ejbCreate method.
>
>        *
>
>        * @ejb.create-method
>
>        *  view-type="local"
>
>        */
>
>       public java.lang.Integer ejbCreate(ProjectValue value) throws
> javax.ejb.CreateException {
>
>             return null;
>
>       }
>
>
>
>       /**
>
>        * The container invokes this method immediately after it calls
> ejbCreate.
>
>        *
>
>        */
>
>       public void ejbPostCreate(ProjectValue value) throws
> javax.ejb.CreateException {
>
>       }
>
>
>
>       /**
>
>       * Returns the number
>
>       * @return the number
>
>       *
>
>       * @ejb.persistent-field
>
>       * @ejb.persistence
>
>       *    column-name="number"
>
>       *     sql-type="int"
>
>       * @ejb.pk-field
>
>       * @ejb.interface-method
>
>       */
>
>       public abstract java.lang.Integer getNumber();
>
>
>
>       /**
>
>       * Sets the number
>
>       *
>
>       * @param java.lang.Integer the new number value
>
>       *
>
>       * @ejb.interface-method
>
>       */
>
>       public abstract void setNumber(java.lang.Integer number);
>
>
>
> ... (other getters / setters)
>
>
>
>       /**
>
>       * Defines the relation to 1 customer.
>
>       *
>
>       * @ejb.relation
>
>       *  name="Customer-Projects"
>
>       *  role-name="project-belongs-to-one-customer"
>
>       *  cascade-delete="yes"
>
>       *
>
>       * @jboss.relation
>
>       *  fk-column="customerNumber"
>
>       *  related-pk-field="number"
>
>       *
>
>       * @ejb.interface-method view-type="local"
>
>       */
>
>       public abstract CustomerBean getCustomer();
>
>       /**
>
>       *
>
>       * @ejb.interface-method view-type="local"
>
>       */
>
>       public abstract void setCustomer(CustomerBean customer);
>
>       /**
>
>       *
>
>       * @ejb.interface-method
>
>       */
>
>       public abstract ProjectValue getProjectValue();
>
>       /**
>
>       *
>
>       * @ejb.interface-method
>
>       */
>
>       public abstract void setProjectValue(ProjectValue value);
>
> }
>
>
>
> Anyone can help or forward a working sample?
>
>
>
> Thanks and Greetings
>
> Arvin Arora
>
>
>
> NEO Business Partners GmbH
>
>
>
> FON +49 (0) 511 123 549 - 0
>
> FAX  +49 (0) 511 123 549 - 49
>
> Mobil +49 (0) 172 51 56 300
>
>
>
> eMail: mailto:[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
> Website: http://www.NEO-Partners.com <http://www.neo-partners.com/>
>
>
>
>
>
>
>
> -------------------------------------------------------
> 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/psa00100006ave/direct;at.asp_061203_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/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to