What version of JBoss are you using?
I'm using JBoss 3.2.1.
Talked to alex, he's fixed one such issue so you may want to test if you see the same behavior with the latest 3.2.2RC3. It is possible there's another bug there too.
I apologize. I was actually using 3.2.2 RC2. I have both on my machine but forgot which one I was running through my IDE... :( So, if it's a bug, then it appears to be in 3.2.2 RC2 as well. I'll try building the latest version from CVS and see where I get there....
I'll also give 4.0 a shot.
The behavior is the same with 3.2.2 RC3.
I will check it. Thanks.
Awesome, thank you!
What's the latest news on this?
Checking the source there is something which strikes me as being weird:
1220 public void setClean(EntityEnterpriseContext ctx)
If this doesn't have a foreign key then do nothing.
If this does have a foreign key do everything.
The check in 1225 is superfluous, which I find hard to believe. Maybe 1222 & 1223 should not be there?
I'll start checking cvs to see if I can find a reason.
22.214.171.124: fixed bug  CMR within one transaction: CMR is considered dirty if the collection was changed but not the CMP fields that make it up (this doesn't work for zero primitives)
126.96.36.199: call setClean on foreign key fields when setClean() is called on CMR field.
(HEAD shows the same code.)
I'm almost convinced that both setClean & isDirty have wrong implementations. I'm going to work on a patch to test my assumptions.
My assumptions were partly wrong. (As was expected :-) )
The cmpFieldIAmMappedTo (JDBCCMP2xFieldBridge) is made dirty in setForeignKey (JDBCCMRFieldBridge).
Should the functionality of setForeignKey be in JDBCCMP2xFieldBridge?
and thus setClean of JDBCCMP2xFieldBridge should setClean the cmpFieldIAmMappedTo also?
For now I'll add this code to setCleanForeignKeyFields.
Looking good, but still I have a problem with bidirectional relations. Probably because of updateFKFieldsMappedToMe.
Hmm, I'm gonna need a little help here.
Thanks for all the effort on this. I got the source and mucked around a bit, but haven't had time to delve into it too deeply. This would be my first time actually playing around with the JBoss source, so I'm sure there will be a significant learning curve.
Again I was off the mark. There was a bug in my own code. So it looks like the problem is solved. :-)
Now to get the patch into CVS. Help!