Free nHibernate Join does insertion into a joined table

I am trying to use join to pull one property from another table that has no mapping. My problem is that when I create a new instance of my mapped object and save it, I get an error message trying to insert into my unallocated table (it tries to insert zero into non-zero columns). I thought using .ReadOnly () would stop nhibernate from trying to insert into my unlabeled table, but this does not seem to work.

My mapping is as follows:

        // Join _UnMapped table with Mapped table to get the property
        Join("_UnMapped", x =>
            {
                x.Fetch.Join();
                x.KeyColumn("UnMappedFK");
                x.Map(y => y.Property, "Property")
                    .Not.Nullable()
                    .ReadOnly();
            });

I thought about creating a view and matching it to get this property, but if I can, I would do it through matching. Any help (or explanation of how the connection should work) would be greatly appreciated!

+5
source share
1 answer

Use x.Inverse();.

There is a connection documentation here .

+8
source

All Articles