All,
I've been having some pretty good success with XDoclet and CMP entity beans. I
am ready to try out XDoclet's CMR features, and I have started with a simple
many-to-one unidirectional relation that looks like this in XDoclet:
/**
* The role ID for this user.
* This is a CMR field
*
* @ejb.interface-method view-type="local"
*
* @ejb.relation
* name="User-Role"
* role-name="User-Has-Role"
* target-ejb="Role"
* target-role-name="Role-Belongs-To-User"
* cascade-delete="yes"
*
* @jboss.relation
* related-pk-field="id"
* fk-column="roleId"
*
*
*/
public abstract Integer getRoleId();
XDoclet is OK with this, and it deploys just fine (the table is created with a
roleId column via the @jboss stuff). It seems to work as it should.
Now how do I use it? First of all, I am generating Value Objects and Data
Objects - these are used with the facade manager beans that XDoclet
generates.
Unfortunately, the roleId is not part of the Value Object or Data Object that
is generated. To get this in those objects you must use the @ejb.persistence
tag, which conflicts with @ejb.relation (it will try to create the column
twice on deployment, resulting in an error).
The other option I see is the @ejb.aggregate tag, which aggregates the
referenced entity in the value object. The docs say that this is used on a
persistent field, so I am assuming that it means a field marked with
@ejb.persistence, which doesn't work with @ejb.relation. Also, using this
apparently causes the related entity to be deleted when the entity itself is
deleted, definitely not a good idea for a many-to-one relationship.
Since I depend on VO/DO to create and manage my entities, I think I need the
CMR field in those objects. Or am I missing something?
-Peter
--
Why don't elephants eat penguins ?
Because they can't get the wrappers off ...
-------------------------------------------------------
This SF.net email is sponsored by: Tablet PC.
Does your code think in ink? You could win a Tablet PC.
Get a free Tablet PC hat just for playing. What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user