If you are going to use foreign key on entityA, then entityB can have many entityA (and you need to use @jboss.relation).
If you really want entityA to have many entityB (according to CMR get/set), foreign key should be on the entityB side.


alex

Ed Storm wrote:

Sorry if this question seems a bit silly.   I am having trouble setting
a cmr between two entities in the way I would like.  This is what I am
looking at:



EntityA

Pk-field: entityAID, an int.

And other data fields


EntityB:ata

Pk-field: entityBId an int

Pk-field: sequence an int

Other data fields

I would like to set a 1:n relation between A and B using entityBId as a
fk in entityA.   I have tried to set this relation up using xdoclet:



In entityA:



/**
*  @ejb.interface-method view-type=”local”
*   @ejb.relation name = “entityA-entityB”
*                       role-name=”1 entityA many entityB”
*                       target-ejb=”EntityB”
*                       target-role-name = “many entityB 1 entity A”
*  @jboss:target-relation related-pk-field = “entityBId”  fk-column =
“entityBId_fk”
**/



public abstract java.util.Set getEntityBs()



and of couse a setter to go along with it.  When I try to deploy this I
get an error concerning the ‘many entityB 1 entity A’ relation:



17:31:12,471 WARN  [ServiceController] Problem starting service
jboss.j2ee:jndiName=EntityA,service=EJB

org.jboss.deployment.DeploymentException: Role: many entityB 1 entity A
with multiplicity many using foreign-key mapping is not allowed to have
key-fields





Does anyone know how I could go about doing this? I can provide a more
concrete example if necessary. I am currently running jboss 3.2.2 rc4




Thanks,

Ed




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





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

Reply via email to