Just a quickie … I have the following ID generator strategy for one of my mapped classes:
<id name="UID" type="System.Guid">
<column name ="UID" sql-type ="uniqueidentifier" />
<generator class="guid.comb" />
</id>
The entity in question is involved in synchronisation / merging behaviours from which it is necessary to have a globally unique identifier.
When an entity is created on a client application for the first time, it’s UID property gets assigned so that it is the same value of the equivilent entity on the server.
However the above ID generator strategy overwrites any value provided for new/transient entities.
Whats the fix? Will I have to remove the generator strategy and assign my own GUIDs? Or is the generator strategy configurable to only generate a guid.comb when required?
I think you can accomplish this by making UID a private field and controlling access through the property.