-
Notifications
You must be signed in to change notification settings - Fork 919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IsAssigned on child entities no longer get correct IsTransient value #1978
Comments
See #1756. It is likely you need to adjust the |
In other words, it is likely that your mapping, lacking in your report, is defining an unsuitable The change you are blaming is the fix for a bug causing |
In the mapping, the unsaved-value wasn't set. However, as we changed the identifiergeneratorstrategy in code (as shown in the example), the unsaved-value was implicitly left with the private static void SetAssignedIdentifierGeneratorStrategy(Configuration configuration)
{
foreach (var classMapping in configuration.ClassMappings)
{
var simpleValue = classMapping.Key as SimpleValue;
if (simpleValue is null)
continue;
simpleValue.IdentifierGeneratorStrategy = "assigned";
simpleValue.NullValue = "undefined";
}
} Thanks for your help. |
We got a project where we want to use two different persisting strategies. In one case, we want the ID of an entity to be set by our database. In the second case, we want nhibernate to set the ID given by our software. In the past, we accomplished this second case by setting the
IdentifierGeneratorStrategy
property toassigned
. However, in the NHibernate update 5.2.0, the check of this property in theIsTransient
method has been removed. As a result, whenever we try to add a child entity with a given ID to a new or existing parent, and then commit the transaction, the sql NHibernate creates for the child entity is an update instead of an insert.Below we created a simplified test project in which nhibernate tries to save (update) the new entity incorrectly:
The exception this code gives is as follows:
This exception is caused by a the following change in the code:
From
NHibernate.Persister.Entity.AbstractEntityPersister.IsTransient()
:To:
(commit 52e3798)
The text was updated successfully, but these errors were encountered: