I have further investigated this problem and the problem has nothing to do with dirty flags, but rather the sync-on-commit-only flag which has no effect.
When using p6spy to check the SQL statements, I see that the insert only contains values for some of the fields, and the update completes the fields. These fields are only set in the SFSB which creates the entity.
Sam question though. Is there any way to tune this? Would make a huge performance difference for my tests.
The persistence managers are of course completely different.
Dirty checking is different. UPDATE includes all the fields in the jdbc2 pm.
In jdbc2 pm you can delay INSERT until commit time using insert-after-ejb-post-create set to FALSE.
Great, that option speeds it up a little more (about 20% in a real world test).
Unfortunately though , I seem to occasionally have uniquness violations on the pk for the n:m link tables. I will investigate further to see if I can build a testcase for this.