Hello,
I'd like to be sure to well understand the relation mapping (CMR) when
using EJB CMP in WebLogic.
So I've got this testCase :
| Actor | <--1---------------------------*--> | Contract |
getContracts() getActor()
| School | <--1---------------------------*---- | Teacher |
null
getSchool()
| Person | ---1----------------------------1--> | Address |
getAdress() null
| PostCode | <--- 1 -------------------- 1 ---> | City |
getCity()
getPostCode()
| Human | <--- 1 --------------------------- 1 ---- | Person |
null
getHuman()
The fact is I'm confused concerning the place where the ejb:relation and
weblogic:column map should be put. Could you validate the following
supposition I've made concerning them ?
For the first relation (actor-contract), I found that :
. On the Actor Bean, you put the key column of it as it is a destination
and the foreign-key-column of Contract :
* @ejb:relation
* name="client-contract"
* role-name="one-actor-has-many-contracts"
*
* @weblogic:column-map
* foreign-key-column="ID_ACTR_CLIENT"
* key-column="ID_ACTR"
. On the Contract Bean, you put only the relation name and the role name :
* @ejb:relation
* name="client-contract"
* role-name="one-contract-belongs-to-one-client"
For the second relation (school-teacher), you put :
. On the School Bean
* @ejb:relation
* name="school-teacher"
* role-name="one-teacher-has-one-school"
*
* @ weblogic:target-column-map
* foreign-key-column="SC_SCHOOL_ID"
* key-column="ID_SCHOOL"
. On the Teacher Bean
// Nothing concerning this relation as it is unidirectionnal
...
-> I'm surely missing something there concerning the unidirectionnal
relations. Could you say me what ?
-> It's look like you always describe the relation column from the N
side of the relation. Is it right ?
-> How is the relation tags made if you've got N/M relation ship ?
Thanks a lot for your responses which solve my headaches :)
Denis.
|