boutin [EMAIL PROTECTED] wrote:
> I'd like to be sure to well understand the relation mapping (CMR) when
> using EJB CMP in WebLogic.
> ...
> | School | <--1---------------------------*---- | Teacher |
null getSchool()
> ...
> 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
You have it backwards, but close. Since you can navigate only from a
Teacher to its School, all of the tags belong in TeacherEJB. As well,
you'll need to add the "target-<foo>" tags that provide what the other
direction would look like.
/**
* @ejb.relation
* name="School-Teacher"
* role-name="Teacher-works-at-a-School"
* cascade-delete="no"
* target-ejb="School"
* target-role-name="School-has-many-Teachers"
* target-cascade-delete="no"
* target-multiple="yes"
* @weblogic.column-map
* foreign-key-column="school_id"
* key-column="id"
*/
public abstract SchoolLocal getSchool ( ) ;
> -> I'm surely missing something there concerning the unidirectionnal
> relations. Could you say me what ?
Yes, see above.
> -> It's look like you always describe the relation column from the N
> side of the relation. Is it right ?
Hmm, for a unidirectional 1:N relation (the reverse of your
School:Teacher example), I suppose you'd still need to put the
column-map on the 1 side. Ah, I do recall there is a
@weblogic.target-column-map tag; that must be what it's for. I haven't
done that type yet, so I can't say for sure.
> -> How is the relation tags made if you've got N/M relation ship ?
Again, I haven't used an N:M relation as in the two cases I have, I need
more information on the relation table than just the foreign keys. Thus,
I modeled the relation table as a bean and used two 1:N relations.
David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user