NHibernate one to one mapping - weird joins? -


I'm having a few problems for a mapping of NHibernate I I'm using Flunt Naibernenet, and this blog post But I'm building my mapping base:

A snippet of tables: dbo.Store -------- - id: int dbo.CheckoutSettings - -------- StoreId: int (dbo.Store.Id from FB)

Here are some HBMs:

  & lt; Class xmlns = "blur: nibinet-mapping -2.2" schema = "management" mutable = "true" name = "store" table = "streo" & gt; & Lt; id name = "id" type = "System.Int32, mscorlib, Version = 4.0.0.0, Culture = neutral, Sarwajnikkitokn = b77a5c561934e089" unsaved-value = "0" & ​​gt; & Lt; Column name = "id" /> & Lt; Generator class = "parent" /> & Lt; / Id & gt; & Lt; One-by-one cascade = "all" square = "checkout setting" constrain = "wrong" name = "checkout settings" /> & Lt; / Square & gt; & Lt; Class xmlns = "blur: nibinet-mapping -2.2" schema = "management" mutable = "true" name = "CheckoutSettings" table = "CheckoutSettings" & gt; & Lt; Id name = "StoreId" type = "System.Int32, mscorlib, version = 4.0.0.0, culture = neutral, public token = b77a5c561934e089" & gt; & Lt; Column name = "store id" / & gt; & Lt; Generator class = "foreign" & gt; & Lt; Param name = "property" & gt; Store & lt; / Param & gt; & Lt; / Generator & gt; & Lt; / Id & gt; & Lt; One-to-one class = "store" foreign-key = "FK_CheckoutSettings_StoreId" name = "store" /> & Lt; / Square & gt;   

Things work at the local level, but saving me errors on our test server, such as the unexpected line number: 0 (expected: 1). Also gives me strange SQL during loading:

  Select Columns checkout settings (column) were left on the left side of the left external version stores CT Chekautstings C keys 1 where c0.Storeid = Id   

and it does not return anything because the checkout settings can not contain any rows for the store.

Any thoughts?

To store TrueSet with unique set, checkout from settings to Mapping:

  & lt; Many-to-one class = "store" name = "store" unique = "true" column = "store id" />   

Checkout settings from the store use asset-reciprocity with one-to-one:

  & lt; One-by-one cascade = "all" class = "checkout setting" constrained = "false" property-ref = "store" name = "CheckoutSettings" />   

You can generate it should be noted that because the store may CheckoutSettings- assets to tap into entities When you get a store, join NHibernate CheckoutTettings table because It is that NHibernate should know that there are checkout settings for stores received in the database so that it can set up CheckoutSettings-property null if none.

Comments