Home » Category » Java Enterprise java bean & Java EE (EJB)

Java Enterprise java bean & Java EE (EJB): XDoclet and @ejb:relation

302| Wed, 16 Jul 2008 22:07:00 GMT| maximsuponya| Comments (0)
Hi,

I'm haveing problems with setting relation between two ejbs using XDoclet tags. For example i've got CountryBean and CityBean, i need to get all cities of the country and country of the city. To do that in CountryBean i have this:

/**
* ...ejb:interface-method view-type="local"
*/
public abstract void setCities(java.util.Collection cities);

/**
* ...ejb:interface-method view-type="local"
* ...ejb:relation
* name="country-cities"
* target-ejb="City"
* role-name="one-country-has-many-cities"
* target-role-name="one-city-belongs-to-one-country"
* target-multiple="no"
*/
public abstract java.util.Collection getCities();

and in CityBean i have this:

/**
* ...ejb:interface-method view-type="local"
*/
public abstract void setCountry(CountryLocal country);

/**
* ...ejb:interface-method view-type="local"
* ...ejb:relation
* name="city-country"
* target-ejb="Country"
* role-name="one-city-belongs-to-one-country"
* target-role-name="one-country-has-many-cities"
*/
public abstract CountryLocal getCountry();

then, when i do city.getCountry() it works just fine, but when i do country.getCities() the Collection it returns is always empty

have i missed something?

Keywords & Tags: xdoclet, @ejb, relation, java, enterprise, bean, ee, ejb

URL: http://java.itags.org/java-bean-j2ee/156685/
 
«« Prev - Next »» 0 helpful answers below.

Java Enterprise java bean & Java EE (EJB) Hot Answers

Java Enterprise java bean & Java EE (EJB) New questions

Java Enterprise java bean & Java EE (EJB) Related Categories