Hi all,

(Sorry if this got send twice to the mailing list, I may have sent it 
twice, because I didn't see it show up the first time I sent this 
message).

I made a CMR relation using xdoclet tags between to entitybeans. 

The relation is as follows:

Group --1--------------------0+-- Category

I defined the relationship as follows:

GroupEJB.java:

/**
 * @ejb.interface-method 
 * @ejb.relation 
 *              name = "Group-Category"
 *              role-name = "GroupHasCategories"
 *              cascade-delete = "no"
 * @ejb.value-object
 *              aggregate = "nl.xbase.category.value.CategoryValue"
 *              aggregate-name = "AllCategories"
 *              members = "nl.xbase.category.interfaces.CategoryLocal"
 *              members-name = "Categories"
 *              relation = "external"
 *              type = "Collection"
 * @jboss.relation-mapping style="foreign-key"
 */
public abstract Collection getCategories();
/**
 * @ejb.interface-method
 * @param categories
 */
public abstract void setCategories(Collection categories);

In CategoryEJB.java:

/**
 * @ejb.interface-method 
 * @ejb.relation 
 *              name = "Group-Category"
 *              role-name = "CategoryBelongsToGroup"
 *              cascade-delete = "yes"
 * @jboss.relation-mapping style = "foreign-key"
 * @jboss.relation
 *              fk-column="group_fk"
 *              related-pk-field="groupId"
 */
public abstract GroupLocal getGroup();
/**
 * @ejb.interface-method
 * @param group
 */
public abstract void setGroup(GroupLocal group);

However, if I have the CategoryValue object. I cannot retrieve it's parent 
Group bean.

I want to something like this:

String id = "AAA0001";
CategoryValue categoryValueObject = mySessionFacade.getCategory(id);
// retrieve the group
GroupValue groupValueObject = categoryValueObject.getParentGroup();

But this does not work. I can only go from Group to Category. Not from 
Category to Group.

Can anybody shed some light on how to solve this?

Many thanks,

Harm de Laat
Informatiefabriek
The Netherlands


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to