NHibernate one-to-one mapping where second table data can be null

后端 未结 2 2011
说谎
说谎 2021-01-11 16:44

I have an existing database with the table Transactions in it. I have added a new table called TransactionSequence where each transaction will ultimately have only one recor

2条回答
  •  粉色の甜心
    2021-01-11 17:16

    Turns out that for my situation a mapping worked best. I just had to make sure that I made the properties that came from the second table were nullable types, or it would do an insert on save even if nothing had changed. Since I did not need lazy loading for the second table, this works great. I am sure that I could have gotten paired many-to-one mappings to work, but it was not intuitive and seems more complicated than the join table option, however is only available in NHibernate 2.0 and up.

提交回复
热议问题