Hi,

we've just started trying out XDoclet for generation of EJB-code and have
been studying the examples included in the download. In the cmr examples
CountryBean has a unidirectional one to many relation to City. We have
managed to recreate this in our own project and would now like to create the
opposite, a unidirectional many to one relation. e.g. CityBean has a many to
one relation to CountryBean and thus contains a get and set Country + tags
for relation and CountryBean contains nothing. We can't get this to work and
hope someone can help us with it. We use weblogic and have tried several
combinations of tags, but keep getting different errors. The most common one
is:

Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was:

In relationship ContractTypeCanHaveMultipleContracts, the
<ejb-relationship-role>,
 many contracts-belong-to-one-contracttype, defined in ejb-jar.xml must have
a
 corresponding <weblogic-relationship-role> in the RDBMS CMP deployment
descriptor
 file with the same name.
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:302) etc.....


Here is an example of our code:

We have a ContractBean and a ContractTypeBean where ContractType can have
many Contracts and we would like Contract to have a unidirectional relation
to ContractType.

>From the ContractBean:

  /**
   * @ejb:interface-method
   *   view-type     ="local"
   *
   * @ejb:relation
   *   name             ="ContractTypeCanHaveMultipleContracts"
   *   role-name        ="many-contracts-belong-to-one-contracttype"
   *   target-role-name ="one-contracttype-has-many-contracts"
   *   target-multiple  ="yes"
   *   target-ejb       ="ContractType"
   */
  public abstract ContractTypeLocal getContractType();

  /**
   * @ejb:interface-method
   *  view-type="local"
   */
  public abstract void setContractType(ContractTypeLocal contractType);

This is one of many versions, we have also tried using weblogic:column-map
even though the documentation says they should only be used when the
foreign-key is in the other bean and we've tried using
weblogic:target-column-map even though it should be used for m:n relations.

The EjbDoclet part of our ant file:


   <!-- Run EJBDoclet -->
   <target name="ejbdoclet" depends="prepare">

      <taskdef name="ejbdoclet"
               classname="xdoclet.ejb.EjbDocletTask"
classpath="${xdoclet.jar.path};${log4j.jar.path};${ant.jar.path}"
      />

      <ejbdoclet
         sourcepath="${java.dir};${log4j.path}"
         classpathref="project.class.path"
         destdir="${generated.src.dir}"
         excludedtags="@version,@author,@date"
         ejbspec="2.0"
         force="${xdoclet.force}">

         <fileset dir="${java.dir}">
            <include name="com/tcms/data/**/*Bean.java" />
            <include name="com/tcms/facade/*Bean.java" />
         </fileset>

         <dataobject pattern="{0}DTO"/>
         <remoteinterface/>
         <localinterface/>
         <homeinterface />
         <localhomeinterface/>
         <entitypk/>
         <session/>

         <deploymentdescriptor destdir="${ejb.dd.dir}" validatexml="true" />

         <weblogic
            version="6.1"
            xmlencoding="UTF-8"
            destdir="${ejb.dd.dir}"
            validatexml="true"
            datasource="jdbc/TRIM"
         />
      </ejbdoclet>
   </target>

We hope someone can help us.

Lisa Arthur and Freddy Tveit


_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to