Let's say I have an e-commerce application where a User can have
multiple Orders.  Let's say that in this domain, a User can cancel his/
her Order which changes its status from "Pending" to "Canceled".  The
only thing that distinguishes a "Pending" Order from a "Canceled"
Order in the database is this status flag.

Now, let's say that "Canceled" Orders don't need to be displayed too
often.  It seems reasonable that my User object might want two lazy-
loaded lists, one for the User's "Pending" Orders and one for the
Users's "Canceled" Orders.  It sounds like I can do this using the
"where" attribute on the "map" element of my NHibernate mappings
(basically having two one-to-many

If I wanted my domain model to contain, say, a lazy-loaded list for
his current Orders as well as a lazy-loaded list of his past Orders,
would that be possible using NHibernate?

Secondly, if it is possible and I wanted to add a "CancelOrder"
function to my User class, what would it do?  Looking at it from the
domain's perspective, it feels like I should find the correct Order
from the "Pending" list, change its status to "Canceled", and move it
to the "Canceled" list.  Will NHibernate be smart enough to figure out
how to persist that?
--~--~---------~--~----~------------~-------~--~----~
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