I meet the same problem.
Maybe the FK cannot be a part of a compound PK for the following reason:
(1)The names of the fields in the primary key class must be a subset of the names of the container-managed fields(EJB 2.0 spec 10.8.2)
(2)An entity bean local interface type(or a collection of such)cannot be the type of a cmp-field.(EJB 2.0 spec 10.3.1).
Hope anyone could tell me if I am right or not.
I think you are probably right.
For now, I have the database enforcing the PK, so I might be able to get away with catching an exception (pk exists type). Not the cleanest way, but I think it will work.
I was hoping for a more elegant, or at least a nicer solution so my bean can more accuartly represent the data.
If I find something I willpost on this topic again.
"container-managed fields" refer to "container-managed persistent fields" or "container-managed relationship fields" or both?
I think if something is to be a primary key, it must also be a field( or attribute) of a Primary Key class. How about if the CMR object is the attribute of a primary key class?