This content has been marked as final.
Show 2 replies
-
1. Re: Foreign key referencing not the primary key
ironbird Jun 2, 2004 8:30 AM (in response to paszti)
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);
-
2. Re: Foreign key referencing not the primary key
paszti Jun 2, 2004 9:27 AM (in response to paszti)Thank you for your reply.