Greetings,

I'm working on a project where we're returning NHibernate graphs from
webservices and i've set up the systems to allow for users to specify
which properties they do, and which they do not want returned.

For example we have an Invoice class, which has one Debtor, a
collection of Reactions and possibly a Limit.

For some calls getting a debtor would not be needed and would only
cause overhead, so users can specify this and due to lazy loading no
call is ever made to the SQL server to retrieve this record. I then
NULL the Debtor property so when serializing hits nothing is there to
trigger a NHibernate call.

The problem lies in the fact that when i try to save anything
NHibernate thinks i should save my Invoice simply because the debtor
property is now nulled. This isn't correct, now i can remedy this by
setting the "not-null" to true in the mapping. I could probably also
Evict the Debtor (or can i evict the invoice which would then evict
the rest of the associated classes aswell???) so NHibernate does not
realise it is dirty.

The problem now lies in Reactions, this is also nullable in a way that
the collection will not be loaded and my users don't generate any
overhead. The problem now lies in when this collection get's updated.
If the collection is set to NULL would this cause updates? I believe
it shouldn't since no cascading has been set. (If i set cascading is
there anyway to handle the situation discribed above?)

Another problem would lie in the Limit property, not all invoices have
a Limit. So i cannot set the property "not-null" to true, since it's
simply not. However i also do not want the limit to be updated
(Limit_ID to be set to NULL in the tbl_Invoice) if this property is
nulled.

What is the best way to handle a situation like this? I don't think
i'm the first to attempt to use NHibernate with webservices but there
aren't to many examples around (or i just suck at using google)

Greetings,

F.B. ten Kate

-- 
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