one-to-one mapping is not working with 2nd-Level-Cache

只谈情不闲聊 提交于 2019-12-04 18:21:24

You do seem to have a problem with the Constrained side of your mapping. According to Ayende's one-to-one guide:

Something else to note is that we must specify this with foreign-key=”none”, because otherwise NHibernate’s Schema Export feature would create two foreign keys for us, which would create a circular reference that wouldn’t allow us to insert anything into the database.

Clearly the FK doesn't actually exist in your database, but the misconfiguration could conceivably cause issues with the cache:

The way to specify foreign-key="none" in Fluent:

this.HasOne(x => x.Activity).Constrained().ForeignKey();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!