Nhibernate One-to-one mapping issue with child object insert error

前端 未结 2 1746
情歌与酒
情歌与酒 2020-12-18 12:58

i\'ve being banging my head against the desk all day with the following Nhibernate problem.

Each bank account has one (and only one) set of rates associated with it.

2条回答
  •  醉梦人生
    2020-12-18 13:43

    One quick way around this would be to make the BankAccountId nullable. NHibernate should insert a record in the BankAccount table with a null id, then update the id.

    In the past I've stumbled on a way to make it do the initial insert with the correct id instead of null. Unfortunately, I can't for the life of me remember what I changed.

提交回复
热议问题