Hi there,

We had a weird exception when we updated the schema of our production 
environment some days ago.
Suddenly some of our users had lost account and roles for their users.
We added columns to our table "Account".

The UserMap (im leaving out som references and maps that i think is 
unimportant):

public class UserMap
{
    public UserMap()
    {
        Map(x => x.UserId);
        Map(x => x.Email);
        HasManyToMany(x => x.Accounts)
            .Table("UserAccountMap")
            .ParentKeyColumn("User_Id")
            .ChildKeyColumn("Account_Id")
            .Cascade.SaveUpdate();
        HasManyToMany<Role>(x => x.Roles)
            .Table("RoleToUserLogin")
            .BatchSize(12);
    }
}

The following query gave an exception after the deployment, and before the 
schema change.

var user = session.QueryOver<User>()
    .Where(x => x.Email == email)
    .Take(1)
    .SingleOrDefault();

As expected this results in an exception because our database schema 
dosen't match our AccountMap.
What was not expected is that this results in a:

delete from UserAccountMap where User_id = {the id of the user}

Im guessing that an proxy for the user is created, and then a proxy for the 
accounts but because of the exception the latter is never inserted in the 
user proxy.

The Question:
What i don't understand is why the faulty query could ever result in a 
delete statement.


I know that the issue originates from a bad upgrade procedure, and we are 
looking into this :)

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to