I've posted the same quetion and it was never answered so I hope someone will answer your post...
I'm starting to think that jboss dosen't support this switch dosen't make any sense...
This has got to be the...second... most simple relationship going!
We need the id column to be both cmp and cmr. If I build the thing with, what I would class as the logical configuration, the only error I get is that the child bean generates an insert statement with the id column occurring twice. If this is 'supposed' to work, I could easily patch the code to look for duplicated column names. I have looked all over for docs on this. The spec does not cover it at all (As it seems to be down to the implementer to supply this part).
I have posted the same problem from a different perspective at
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ there seems to be a problem when a foreign key is part of a primary key. When it is not part of the primary key, I can get around the duplicate column problem by commenting out the individual abstract foreign key get/sets and CMP field definitions. But, this doesn't work when it's part of the primary key, because it needs to select these columns.
I hope we find an answer. This is a show stopper for me. I really don't want to redesign the database just to get around a bug, particularly when I need backward compatibility with a working and in production 2.4 version.
I would also like an answer to these questions.
Given that work has started on version 4, I would guess a backport of this feature to version 2 is unlikely.
I can see one really ugly possible workaround. It would involve adding some new tables and possibly some triggers, so it's not worth persuing unless you can do that to your production database and are getting desperate for workarounds.
So .. its a "fact" that using CMR fields as a part of the primary key in EJBs is not possible in the latest stable version of JBoss?
There are others who can speak more authoritatively but my understanding is that a fix for this is in 3.2, which is currently at Release Candidate status.