Your jboss <ejb-relation> is incorrect.  I strongly
suggest you read JBoss's JBoss Administration and
Development Guides available for free now at JBoss's
website.  With a quick glance I saw multiple errors
and  realized it would be simpler and more beneficial
to you if you read the manuals.

You have not specified the foreign keys and their
related primary key fields correctly.  I strongly urge
you read the manuals.  The information is presented
well enough at this point.  For this problem you only
need to read the section on CMRs.

You should understand that XDoclet's @jboss.relation's
related-pk-field corresponds to an entity bean's
primary key field (the java code primary key field)
and that the fk-column references the actual
datasource's column name.  Read the manual, it will
explain all of this and more.

Your jbosscmp-jdbc.xml should look something like the
following for a one-to-one unidirectional relationship
from Author to Image:

     <ejb-relation>
      
<ejb-relation-name>Author-Image</ejb-relation-name>

       <ejb-relationship-role>
 
<ejb-relationship-role-name>Author-has-Image</ejb-relationship-role-name>
          <key-fields>
             <key-field>
               <field-name>id</field-name>
               <column-name>author_id</column-name>
             </key-field>
             <key-field>

       </ejb-relationship-role>
       <ejb-relationship-role>
 
<ejb-relationship-role-name>Image-has-Author</ejb-relationship-role-name>
                  <key-fields/>

       </ejb-relationship-role>
     </ejb-relation>

Thanks.


--- Alexander Czernay <[EMAIL PROTECTED]> wrote:

> I have two entity-beans (AuthorBean, ImageBean) that
> should have a 
> unidirectional one-to-one relation
> (Author-has-Image). I set it all up 
> using Eclipse and XDoclet. After running XDoclet
> everything seems to be 
> generated well, but it doesn't get deployed (on
> JBoss 4):
> 
> ERROR [EntityContainer] Starting failed 
> jboss.j2ee:jndiName=ejb/ImageBeanHome,service=EJB
> org.jboss.deployment.DeploymentException: Entity: 
> de.sbow.MSys.Images.ejb.ImageBean not found for
> relation: Author-Image
> 
> Investigating the ejb-jar.xml and jbosscmp-jdbc.xml
> I found in 
> jbosscmp-jdbc.xml the follwing:
> 
>      <ejb-relation>
>       
> <ejb-relation-name>Author-Image</ejb-relation-name>
> 
>        <ejb-relationship-role>
>  
>
<ejb-relationship-role-name>Author-has-Image</ejb-relationship-role-name>
>                 <key-fields/>
> 
>        </ejb-relationship-role>
>        <ejb-relationship-role>
>  
>
<ejb-relationship-role-name>Image-has-Author</ejb-relationship-role-name>
>            <key-fields>
>               <key-field>
>                 <field-name></field-name>
>                 <column-name></column-name>
>               </key-field>
>            </key-fields>
> 
>        </ejb-relationship-role>
>      </ejb-relation>
> 
> I wonder what I've done wrong?
> 
> Thanks for any help
> Alexander
> 
> AuthorBean.java
> package de.sbow.MSys.Authors.ejb;
> 
> import java.util.Collection;
> 
> import javax.ejb.CreateException;
> import javax.ejb.EJBException;
> import javax.ejb.EntityBean;
> import javax.ejb.EntityContext;
> import javax.ejb.RemoveException;
> 
> import
> de.sbow.MSys.Authors.interfaces.AuthorBeanUtil;
> import de.sbow.MSys.Authors.value.AuthorBeanValue;
> import de.sbow.MSys.Images.ejb.ImageBean;
> import
> de.sbow.MSys.Images.interfaces.ImageBeanLocal;
> 
> 
> /**
>   *
>   * @ejb.bean         name = "AuthorBean"
>   *                   type = "CMP"
>   *                   cmp-version = "2.x"
>   *                   display-name = "AuthorBean"
>   *                   description = "AuthorBean EJB"
>   *                   view-type = "both"
>   *                   jndi-name = "ejb/AuthorHome"
>   *                   local-jndi-name =
> "ejb/AuthorLocalHome"
>   *                           primkey-field = "id"
>   *                           schema = "Authors"
>   *
>   * @ejb.persistence  table-name = "Authors"
>   * @jboss.persistence        table-name = "Authors"
>   *                                           create-table = "true"
>   *                                           remove-table = "true"
>   *
>   *
>   * @ejb.finder       signature = "java.util.Collection
> findAll()"
>   *                           query = "select Object(l) from Authors as l"
>   *
>   * @ejb.finder       signature = "java.util.Collection 
> findByName(java.lang.String name)"
>   *                           query = "select Object(l) from Authors as l
> where l.name = ?1"
>   *
>   * @ejb.finder       signature = 
> "de.sbow.MSys.Authors.interfaces.AuthorBeanLocal 
> findById(java.lang.String id)"
>   *                           query = "select Object(l) from Authors as l
> where l.id = ?1"
>   *
>   *
>   *  @ejb.util
>   *      generate="physical"
>   *
>   *  @ejb.value-object
>   */
> public abstract class AuthorBean implements
> EntityBean {
> 
>       /** The EntityContext */
>       private EntityContext context;
> 
>       /**
>        *
>        * @ejb.create-method
>        */
>       public String ejbCreate() throws CreateException {
>               this.setId(AuthorBeanUtil.generateGUID(this));
>               return null;
>       }
> 
>       /**
>        * @ejb.create-method
>        * @param name
>        * @param description
>        * @return
>        */
>       public String ejbCreate(String name, String
> description) throws 
> CreateException {
>               this.setName(name);
>               this.setDescription(description);
>               this.setId(AuthorBeanUtil.generateGUID(this));
>               return null;
>       }
>       
>       /**
>        * TODO check if this works!
>        * @ejb.create-method
>        * @param data
>        * @return
>        * @throws CreateException
>        */
>       public String ejbCreate(AuthorBeanValue data)
> throws CreateException {
>               this.setId(AuthorBeanUtil.generateGUID(this));
>               //data.setId(this.getId());
>               this.setAuthorBeanValue(data);
>               return null;
>       }
>       /**
>        *
>        * @throws CreateException Thrown if the instance
> could not perform
>        * the function requested by the container because
> of an system-level 
> error.
>        */
>       public void ejbPostCreate() throws CreateException
> {
>       }
> 
>       /**
>        *
>        * @throws EJBException Thrown if the instance
> could not perform
>        * the function requested by the container because
> of an system-level 
> error.
>        */
>       public void ejbActivate() throws EJBException {
>       }
> 
>       /**
>        *
>        * @throws EJBException Thrown if the instance
> could not perform
>        * the function requested by the container because
> of an system-level 
> error.
>        */
>       public void ejbPassivate() throws EJBException {
>       }
> 
>       /**
>        *
>        * @throws EJBException Thrown if the instance
> could not perform
>        * the function requested by the container because
> of an system-level 
> error.
>        */
>       public void ejbLoad() throws EJBException {
>       }
>       /**
>        *
>        * @throws EJBException Thrown if the instance
> could not perform
>        * the function requested by the container because
> of an system-level 
> 
=== message truncated ===



        
                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to