Quote:
But given the cascade=none, why does it CARE if it's dirty
Because cascades only pertain to "relation management". Once an entity is loaded (as your C instance must be), the Hibernate Session tracks the entity for any changes made to it that need to get flushed.
Quote:
Problem #2:
Object C has a number components (DayRange), each of which have two components (Day) each of which contains a java.util.Date. It's possible for an empty DayRange to exist, which will be store to the database as NULL, NULL, for the two columns it is ultimately mapped to. The problem is that on the second pass through "flush()", Hibernate seems to think it's dirty because we have a DayRange object which is not == null, but contains two nulls. This doesn't seem correct to me.
During load, when Hibernate encounters a component for which all the columns spanned are null it considers that component in its entirety as being null and assigns the mapped property the value of null. At some point, I am guessing your code sets the reference to be a new DayRange instance (with both properties null or whatever, doesn't matter). During flush, Hibernate no longer finds the same value in the property that it placed there during load, thus it considers it dirty. This is totally expected and correct.