This content has been marked as final. Show 2 replies
Is it permitted for the foreign key to point not to the primary key of the one side but to a common CMP field?
No, the foreign key constraint must be with a primary key.
Moreover, I'd like to make this relationship unidirectional to the one side, using a Collection typed CMR field.
How this could be accomplished using XDoclet?
Here is it:
* @ejb.interface-method * @ejb.relation * name="BeanA in relation with BeanB" * role-name="BeanA-has-many-BeanB" * target-ejb="BeanB" * target-role-name = "BeanB-has-one-BeanA" * * @jboss.target-relation * fk-column = <The column name in the table for BeanB> * related-pk-field = <The BeanA cmp field name (primary key)> */ public abstract java.util.Collection getBeanBs(); /** * @ejb.interface-method */ public abstract void setBeanBs(java.util.Collection arg);
Thank you for your reply.