posted 22 years ago
I'm using CMR with WLS6.1SP3 and found the
following problems for one-to-many
unidirectional relationships:
A DEPARTMENT can have many COURSEs that can also many STUDENTs.
The tables in DB is something like:
DEPARTMENT table has an ID as its primary key,
COURSE_ID as foreign key, and other data
columns.
COURSE table has an ID as its primary key,
STUDENT_ID as foreign key, and other data
columns.
STUDENT table has an ID as its primary key
and other data columns.
I'm using compound primary keys for DEPARTMENT
CMR entity bean and COURSE CMR entity bean.
For DEPARTMENT CMR bean I have DepartmentPK
that contains ID and CourseID.
For COURSE CMR bean I have CoursePK
that contains ID and StudentID.
It worked fine for the relationship between
DEPARTMENT and COURSE. When I added the
relationship between COURCE and STUDENT and
ran weblogic.ejbc, I got following errors:
"In relationship 'Course-Student',
role 'Student-belongs-to-Course', a
weblogic-relationship-role element contains
the wrong number of column mappings. A single
column mapping must be given for each primary
key column in the bean referenced by the mapping."
But I have mapped them in my
weblogic-cmp-rdbms-jar.xml deployment descriptor
as:
...
<weblogic-rdbms-relation>
<relation-name>Course-Student</relation-name>
<weblogic-relationship-role>
<relationship-role-name>Student-belongs-to-Course</relationship-role-name>
<column-map>
<foreign-key-column>STUDENT_ID</foreign-key-column>
<key-column>ID</key-column>
</column-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
...
Is this a bug in WLS6.1SP3 because it is not
certified for EJB2.0? Or did I do something
wrong?
Thanks.