Issue:

Object 1 - 'Cost'
Object 2 - 'Costy Type (Master Data)'

A 'Cost' object has a 'Cost Type' Object setup through a many-to-one
mapping.  The Cost to Cost Type mapping is done through 'Property
Ref'.  Cost does not reference the primary key of the Cost Type
object.

When I load a 'Cost' object, nHibernate correctly sees that the Cost
Type object mapping is using PropertyRef and does not attempt to lazy
load the Cost Type object.  I understand this, this is not my problem.

Problem:  I set the Cost.CostType property to a 'proxied' CostType
object.  Not on purpose, it just so happend that when I loaded up the
CostTypes I got them as proxies.  However when nHibernate goes to grab
the 'id' of the proxied CostType object to persist it into the Cost
object it returns NULL.

When I set the property of an object equal to a proxied object when
their relationship is via PropertyRef instead of the PrimaryKey / ID
column, nHibernate does not persist the relationship correctly as
Proxied objects do not hydrate non-ID columns.

Question:  Anyone have any ideas to work around / resolve this besides
basically setting all my classes to non-lazy?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to