views:

51

answers:

0

Code

    public void SaveProduct(Product product)
    {
        using (var session = GetNewSession())
        {
            using(var tran = session.BeginTransaction())
            {
                session.SaveOrUpdate(product);
                tran.Commit();
            }
        }
    }

Product is an entity with parent/child relation, with cascade. I'm trying to delete an element from children collection. I get a new session every time.. In unit tests this method works, in my application it doesn't - nHibernate just does not generate DELETE sql statements for children. Any ideas why?.. What can be different in the tests and the application which make nHib behave like this?