We've tried out manytomany with middlegen, both unidirectional and
bidirectional,(Using the middlegen HEAD as suggested and the xdoclet,
xjavadoc, weblogic-module versions included with it) but I'm not sure we got
the same problems as you said you had. Running XDoclet was no problem, but
when running the weblogic server we got:
<23.apr.02 13:33:35 CEST> <Error> <J2EE> <Error deploying application
ejbtcmstes
t:
Unable to deploy EJB: ejbtcmstest.jar from ejbtcmstest.jar:
The XML parser encountered an error in your deployment descriptor. Please
ensure
that your DOCTYPE is correct. You may wish to compare your deployment
descripto
rs with the WebLogic Server examples to ensure the format is correct. The
error
was:
weblogic.xml.process.SAXValidationException: Duplicate ejb name Company in
ejb-j
ar.xml
at
weblogic.ejb20.dd.xml.EjbJarLoader_EJB20.__post_8(EjbJarLoader_EJB20.
java:2988)
at
weblogic.ejb20.dd.xml.EjbJarLoader_EJB20.postProc(EjbJarLoader_EJB20.
java:1942)
at
weblogic.xml.process.ProcessorDriver.postProc(ProcessorDriver.java:19
4)
at
weblogic.xml.process.ProcessorDriver.endElement(ProcessorDriver.java:
88)..........
for both unidirectional and bidirectional.
Looking at the ejb-jar.xml and the other xml files it seems that xdoclet is
generating duplicate descriptions of the beans. For each bean there is two
<entity></entity> tags with the same content, this is what is causing the
error. Other entries are also duplicated in the different xml files. And the
<relationships> part in ejb-jar.xml looks like this:
1.
<!-- Relationships -->
<relationships >
<ejb-relation >
<ejb-relation-name>contract_type-contract-cmp</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>contract-has-contract_type</ejb-relationship-rol
e-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>Contract</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>contractType</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>contract-has-contract_type</ejb-relationship-rol
e-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>Contract</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>contractType</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
2.
This is supposed to be the many-to-many relation, unidirectional:
<ejb-relation >
<ejb-relation-name>COMPANY-CONTRACT-cmp</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>contract-has-company</ejb-relationship-role-name
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>Contract</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>companies</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>contract-has-company</ejb-relationship-role-name
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>Contract</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>companies</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
</relationships>
While in a version that works(using the BEFORE_CLASSTYPE_REFACTORING version
of middlegen and the xdoclet version included with it), the relation for
contract_type-contract (many-one) (1. above) looks like this:
<ejb-relation >
<ejb-relation-name>contract_type-contract</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>contract-has-contract_type</ejb-relationship-rol
e-name>
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>Contract</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>contractType</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>contract_type-has-contract</ejb-relationship-rol
e-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>ContractType</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
This is from the tags generated by middlegen:
/**
* Returns a collection of local ContractType
*
* @return a collection of local ContractType
*
* @ejb:interface-method view-type="local"
*
* @ejb:relation
* name="contract_type-contract"
* role-name="contract-has-contract_type"
* target-ejb="ContractType"
* target-role-name="contract_type-has-contract"
* target-multiple="yes"
*
*
* @weblogic:target-column-map
* foreign-key-column="C_T_ID"
* key-column="C_T_ID"
*
*/
public abstract middlegen.demo.ejb.ContractTypeLocal getContractType();
and it works just fine :)
These are the tags generated with the HEAD version of middlegen:
/**
* Returns a collection of local ContractType
*
* @return a collection of local ContractType
*
* @ejb:interface-method view-type="local"
*
* @ejb:relation
* name="contract_type-contract-cmp"
* role-name="contract-has-contract_type"
* target-ejb="ContractType"
* target-role-name="contract_type-has-contract"
* target-multiple="yes"
*
*
* @weblogic:target-column-map
* foreign-key-column="C_T_ID"
* key-column="C_T_ID"
*
*/
public abstract middlegen.demo.ejb.ContractTypeLocal getContractType();
As they look exactly the same, the resulting entry in ejb-jar.xml should be
the same, which it is not(see 1.). So there must be something wrong with the
version of xdoclet included with the HEAD version of middlegen. We tried
getting a newer version of xdoclet(23.4), but got the same problem.
Hope this can help you fix the problems :)
The tags generated for our unidirectional many to many relation look like
this in Contract, where Company is the other table/bean and Contract_Company
the joint-table, the ejb-jar.xml entry for this relation was shown earlier
at 2.:
/**
* Returns a collection of local Companies
*
* @return a collection of local Companies
*
* @ejb:interface-method view-type="local"
*
* @ejb:relation
* name="COMPANY-CONTRACT-cmp"
* role-name="contract-has-company"
* target-ejb="Company"
* target-role-name="company-has-contract"
* target-multiple="yes"
* @weblogic:relation
* join-table-name="CONTRACT_COMPANY"
*
*
* @weblogic:column-map
* foreign-key-column="CONTRACT_NO"
* key-column="CONTRACT_NO"
*
* @weblogic:target-column-map
* foreign-key-column="COMPANY_ID"
* key-column="COMPANY_ID"
*
* @jboss:relation
* fk-constraint="true"
* fk-column="CONTRACT_NO"
* related-pk-field="CONTRACT_NO"
*/
and I think that should work, so the problem might be xdoclet????
Hope this wasn't too confusing.
Lisa and Freddy
-----Original Message-----
From: ***@netcom.no [mailto:***@netcom.no]
Sent: 23. april 2002 14:49
To: Lisa M Arthur
Cc: middlegen-***@lists.sourceforge.net
Subject: Re: RE: [Middlegen-user] Many to many relations
Until we (I have a new team member, Eivind Waaler) release the next
version of Middlegen, you should always use xdoclet.jar, xjavadoc.jar
and weblogic-module.jar from Middlegen CVS. As we work on Middlegen, we
regularly build those jars from the xdoclet CVS and put them in
Middlegen CVS. Why? Because we sometimes have to fix XDoclet while we
work on Middlegen.
FYI: Middlegen 1.2 will be released shortly after the next xdoclet
version is released. That's probably within a time-frame of 2-4 weeks.
/Aslak
----- Original Message -----
From: "Lisa M Arthur" <***@logit-systems.com>
Date: Tuesday, April 23, 2002 1:53 pm
Subject: RE: [Middlegen-user] Many to many relations
Post by Lisa M ArthurHi,
we've started trying this out and get different errors with different
versions of XDoclet (we tried out different versions just in case
:) ), so
we'd like to know which version we should be using?
Thanks,
Lisa and Freddy
-----Original Message-----
Sent: 22. april 2002 23:25
Subject: RE: [Middlegen-user] Many to many relations
Hi!
I have committed some experimental support for m:n relations to
the HEAD
branch (which should be more stable now, so I suggest you revert
to that).
See the samples/build.xml for an example about how to use it (set
many2many="true" in middlegen task)
-unidirectional m:n relationships cause xdoclet to throw an
exception during
generation of weblogic-cmp-rdbms-jar.xml.
-bidirectional m:n relationships seem to pass OK in xdoclet, but
ejbc will
choke.
middlegen or
xdoclet - don't know where yet). At least the java code is correct...
Try it out and let me know how it goes. If you get the same
symptoms as me
and decide to "hand-fix" the weblogic-cmp-rdbms-jar.xml so that
ejbc accepts
it, it would be great if you could send me the xdoclet-generated
weblogic-cmp-rdbms-jar.xml and the hand-modified one. It would
make it
easier for me to fix the bug(s)
Cheers,
Aslak
-----Original Message-----
Lisa M
Arthur
Sent: 22. april 2002 11:30
Subject: [Middlegen-user] Many to many relations
Hi,
we want to generate a many to amny relation using middlegen, but
don't want
it to generate the joint-table. E.g. Contract - Company have a
many to many
relation with a jointtable in the database called Contract_Company.
Middlegen generates a ContractBean, CompanyBean and a
ContractCompanyBean> where Contract has a relation to
ContractCompany with a collection of
ContractCompanies, ContractCompany has relations to Contract and
Company> with one Contract and one Company and Company has a
relation to
ContractCompany with a collection of ContractCompanies. This is
not what we
want.
What we want is that there should be a ContractBean and a
CompanyBean where
ContractBean should have a relation to CompanyBean with a
Collection of
Companies and Company should have a relation to Contract with a
collection> of contracts and a joint_table should be specified in
both. Like
the example
/**
*
* name="language-city"
* role-name="many-city-has-many-language"
*
* join-table-name="LANGUAGE_CITY"
*
* foreign-key-column="language_id_fk"
* key-column="language_id"
*/
/**
*
* name="language-city"
* role-name="many-language-has-many-city"
*
* join-table-name="LANGUAGE_CITY"
*
* foreign-key-column="city_id_fk"
* key-column="city_id"
*/
If it is possible for middlegen to do this, can someone please
explain what
we have to do?
BEFORE_CLASSTYPE_REFACTORING> and the xdoclet version included in
this, and Oracle8i.
Thanks,
Lisa and Freddy
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user