facebook

XDoclet n:m relationship error w map table

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #223823 Reply

    drowell
    Member

    – System Setup ——————————-
    Operating System and version: Linux Redhat Fedora Core
    Eclipse version: 3.0.1
    Eclipse build id: 20040961125
    Fresh Eclipse install (y/n): y
    If not, was it upgraded to its current version using the update manager?
    Other installed external plugins:
    Number of plugins in the <eclipse>/plugins directory that begin with org.eclipse.pde.*:
    MyEclipse version: 3.8.3
    Eclipse JDK version: 1.4.2
    Application Server JDK version: 1.4.2
    Are there any exceptions in the Eclipse log file? None

    David Rowell
    davidallanrowell@hotmail.com
    ————————————————–

    I’m trying to create a relationship between Visitor and Country entity beans. The relationship is using a map table VisitorInterestCountry to form a n:m relationship. When I try to deploy I’m getting the error

    org.jboss.deployment.DeploymentException: Role ‘country-has-visitor’ on Entity Bean ‘Country’ : CMP field for key not found: field name=’visitorId’

    Will MyEclipse XDoclet handle a n:m relationship, and if so; how do we implement this?
    ————————————————–

    
    From Visitor.java
    
     
    
    XDoclet-based CMP 2.x entity bean.  This class must be declared
    
     * public abstract because the concrete class will
    
     * be implemented by the CMP providers tooling.
    
     * 
    
     * To generate EJB related classes using XDoclet:
    
     *
    
     *                      - Add Standard EJB module to XDoclet project properties
    
     *                      - Customize XDoclet configuration
    
     *                      - Run XDoclet
    
     * 
    
     * Below are the xdoclet-related tags needed for this EJB.
    
     *
    
     * @ejb.bean name="Visitor"
    
     *           display-name="Visitor"
    
     *           description="Visitor EJB"
    
     *           jndi-name="ejb/VisitorHome"
    
     *           local-jndi-name = "ejb/VisitorLocalHome"
    
     *           type="CMP"
    
     *           cmp-version="2.x"
    
     *           view-type="local"
    
     *           primkey-field = "visitorId"
    
     * 
    
     * @ejb.pk class="java.lang.Integer" generate="false"
    
     * 
    
     * @ejb:util generate="physical"
    
     * 
    
     * @ejb:persistence table-name = "Visitor"
    
     * 
    
     * @ejb.value-object name = "Visitor"
    
     *                                  match="*"
    
     * 
    
     * @jboss.persistence create-table="true"
    
     *                                  remove-table="true"
    
     * 
    
     */
    
     
    
     
    
    /**
    
     *          @ejb.interface-method
    
     *          @ejb.persistence colum-name = "VisitorId"
    
     */
    
    public abstract Integer getVisitorId();
    
    public abstract void setVisitorId(Integer visitorId);
    
                
    
     
    
    /**
    
                 * @ejb.value-object
    
                 *                      aggregate="com.hobsons.nafsa.model.entity.interfaces.CountryValue"
    
                 *                      aggregate-name="InterestedCountry"
    
                 *                      members="com.hobsons.nafsa.model.entity.interfaces.CountryLocal"
    
                 *                      members-name="InterestedCountry"
    
                 *                      relation="external"
    
                 *                      type="java.util.Collection"
    
                 * 
    
                 * @ejb.relation
    
                 *                      name="Visitor-Interest-Country"
    
                 *                      role-name="visitor-has-country"
    
                 * @jboss.relation related-pk-field="visitorId"
    
                 *                                                          fk-column="countryId"
    
                 * @jboss.relation-table table-name="VisitorInterestCountry"
    
                 *                                                                                              create-table="true"
    
                 *                                                                                              delete-table="true"
    
                 */
    
                public abstract Collection getInterestedCountry();
    
     
    
    From Country.java
    
     
    
    /**
    
                 * @ejb.relation
    
                 *                      name="Visitor-Interest-Country"
    
                 *                      role-name="country-has-visitor"
    
                 * @jboss.relation related-pk-field="countryId"
    
                 *                                                          fk-column="visitorId"
    
                 * 
    
                 */
    
                public abstract java.util.Collection getVisitor();
    
    

    davidallanrowell@hotmail.com
    David Rowell

    #223840 Reply

    Riyad Kalla
    Member

    If any users had thoughts on this it would be appreciated if you could help out.

    #224867 Reply

    drowell
    Member

    We found that Xdoclet was not correctly generating the COMP_NAME value for our session beans. We had to manually change this and then we were able to get everything to work. We may have an erroneous XDoclet configuration — not sure, but this workaround will do.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: XDoclet n:m relationship error w map table

You must be logged in to post in the forum log in