This problem exists with RC2 and MySQL as well. The only way way I could get around it was to remove the not null attribute on the foreign key column in MySQL. Can a set method for a non null foreign key column be placed in ejbPostCreate()?
Thanks for your help.
I reported this behavior as a bug. This bug was closed with the comment, that with Version 3.1 it should be possible to set CMR fields before the physical insert into the database.
Till now, the only workaround is do delete the foreign (indexed row)in the mysql database. But after this, you have no referential integrity. Under Bea Weblogic you can place your setter into the ejbPostCreate() method. I think, with 3.1 it will also be possible with JBoss.