I have exactly the same problem. I have been searching for a solution and it looks like the CMP2 specification has this restriction: the cmr is between beans in the same ejb jar.
Can anybody tell me if the JBOSS implementation has this restriction... Could it be used between beans in the same ear file?
Please, if somebody can tell me something about this issue I will appreciate it very much !!!
I had the same problem as well. The only thing I can suggest is to have a xml file for all the persistence (CMP) and have a separate xml for every session bean.
Actually, after reading the spec, jars are never mentioned as far as I could see. It does say the following: "Container-managed relationships can exist only among entity beans within the same local relational scope, as defined by the element in the deployment descriptor". It could be interpreted to mean that the 'local relational scope' means the same descriptor or the same jar. However, this is merely one interpretation. There's nothing that says an implementation couldn't acknowledge all entity beans deployed on the same machine as being part of the same 'local relational scope'.
Does anyone know if this issue been brought up with Sun as a JSR? It wouldn't be the first mistake Sun has made (e.g. remote/local interfaces requiring code changes).
It looks like for now I'll be managing some of my relationships myself in the session layer until somebody at Sun or JBoss decides to circumvent this problem. Thanks for all the replies so far. I'm still interested in hearing other thoughts on this subject. I wonder how many people are actually using CMR in production code these days?
Hello rakn. Thanks for the reply, although I don't understand your suggestion. Could you please explain?