Hello,
I'm posting this to the mailing list so xdoclet/jboss/j2ee newbies can find
help on the list archives from a couple of other newbies who figured out how
to get the xdoclet samples to run (or at least be deployed without errors ;-)
on JBoss 3.0. I'm very new to the game, so please ammend any mistakes.
First a couple of newbie-notes:
* This list was compiled based on the xdoclet 1.1.2 zip file distribution,
not cvs.
* Ignore all the "cannot resolve symbol"/"cannot resolve class" errors during
the ejbdoclet task. You'll notice that the ant script ignores those errors,
which is quite on purpose. The problem is that javadoc is trying to track
down all the classes used in the template, but quite a few of the references
are for classes and interfaces that have not yet been generated by xdoclet
yet. It's a chicken and the egg situation that is well described in other
documents.
* The unix shell script, build.sh, has dos line feeds in it and needs to be
dos2unix-ified before you can use it.
* As stated in the documentation for the samples, you'll need to copy the
xdoclet and ant jar files into samples/lib before you invoke the build script.
The Changes:
1. add @jboss:table-name to AddressBean.java so that JBoss won't try to
create the table based on ejb-name, "addr/Address", which is an invalid table
name.
/**
* @ejb:bean name="addr/Address" type="CMP" jndi-name="ejb/addr/Address"
view-type="local"
*
* @ejb:finder signature="Collection findByOwner(test.interfaces.Customer
owner)"
*
* @ejb:value-object name="Address" match="*" instantiation="eager"
*
* @jboss:table-name "address"
*/
public abstract class AddressBean implements EntityBean
2. add @jboss:relation tags for the relationship between CityBean and
LanguageBean so that xdoclet can correctly generate the jbosscmp.xml file.
LanguageBean.java:
/**
* @return all cities of this language
*
* @ejb:interface-method view-type="local"
* @ejb:relation
* name="city-language"
* role-name="many-language-has-many-city"
*
> * @jboss:relation
> * related-pk-field="id"
> * fk-column="city_id_fk"
> * fk-constraint="false"
> *
> * @jboss:relation-table table-name="languages_to_cities"
*
* @weblogic:relation
* join-table-name="LANGUAGE_CITY"
*
* @weblogic:column-map
* foreign-key-column="city_id_fk"
* key-column="city_id"
*/
public abstract java.util.Collection getCities();
CityBean.java
/**
* @return all languages of this city
*
* @ejb:interface-method view-type="local"
* @ejb:transaction type="Supports"
* @ejb:relation
* name="city-language"
* role-name="many-city-has-many-language"
*
> * @jboss:relation
> * related-pk-field="id"
> * fk-column="language_id_fk"
> * fk-constraint="false"
> *
> * @jboss:relation-table table-name="cities_to_languages"
*
* @weblogic:relation
* join-table-name="LANGUAGE_CITY"
*
* @weblogic:column-map
* foreign-key-column="language_id_fk"
* key-column="language_id"
*/
public abstract java.util.Collection getLanguages();
3. Change @ejb:bean:cmp-version in CustomerBean.java to 2.0.
* @ejb:bean type="CMP" name="bank/Customer" jndi-name="ejb/bank/Customer"
view-type="remote" use-soft-locking="true" cmp-version="2.x"
4. Add an import in the CustomerBMPBean.java template for the neccessary
interfaces that will be generated by xdoclet:
import test.interfaces.AddressLocal;
5. The AllTypesEntityBean has incorrect types in the primary key get/set
methods. They are distributed as Integer, but since xdoclet is generating a
primary key class, AllTypesEntityBeanPK, the methods should use that type
instead. Otherwise JBoss will complain because the EJB generated by the
container has a primary key type of Integer, but the deployment descriptor
states that the type is AllTypesEntityBeanPK. You'll also need to add an
import for the yet-to-be-generated AllTypesEntityBeanPK class;
import test.interfaces.AllTypesEntityBeanPK;
public abstract AllTypesEntityBeanPK getId();
public abstract void setId(AllTypesEntityBeanPK id);
6. Also in AllTypesEntityBean, you'll need to add a getABoolean method to
match the setABoolean and isABoolean methods. JBoss (not sure about
j2ee/ejb2.0 in general, but I'd assume yes) requires that there are get AND
set methods for any persisted field.
/**
* * Get the value of aBoolean
* *
* * @ejb:interface-method view-type="remote"
*/
public abstract boolean getABoolean();
7. Remove the @jboss:time-out from CustomerBean.java.
line 38-> * @jboss:time-out "100"
-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user