I have a one to many relationship configured. I know that the foreign key column in my many table has to allow for NULL values according to the EJB spec. As far as I know an INSERT occurs that populates the row except for the foreign key value. Then an UPDATE occurs populating the foreign key. I also have commit-option d configured for these 2 entity beans with a cache refresh of 5 minutes. When I perform several inserts into the many table, it appears that, at times, the UPDATE to populate the foreign key does not occur leaving the foreign key value NULL. I believe it is due to the fact that the cache is refreshing at the same time the UPDATE is being attempted. I see a few Unable to passivate due to ctx lock, id=32901 warnings around the time this occurs. By reducing the cache refresh time, I can more easily reproduce the issue.
Should I be using a different commit-option? Is there a way I can catch the fact that the foreign key value is never comitted to the database? I am using JBoss 3.2.0. Thanks.