I agree, I *want* unidirection here but feel like my limited knowledge is pushing me towards bidrectional.
Thank you for your help....willl report back. On Tue, Oct 21, 2008 at 11:13 AM, Gabriel Schenker <[EMAIL PROTECTED]>wrote: > when working uni-directional you have to provide the table name of the > children (that is the WishList items) in the mapping... > And about DDD: in the DDD book of Evans he states that uni-directional > relations are preferable. That does not mean that under certain > circumstances there shouldn't be a bi-directional relation. As always "it > depends" > > > On Tue, Oct 21, 2008 at 6:04 PM, Tim Barcz <[EMAIL PROTECTED]> wrote: > >> I can make this work if this bidirectional....however I'm needing some >> guidance as to whether things should be bidirectional or not. Seems like >> the domain should dictate, however am not seeing it so simply. >> >> >> On Tue, Oct 21, 2008 at 10:57 AM, Tim Barcz <[EMAIL PROTECTED]> wrote: >> >>> Inverse=true give me two sql statements as expected, however it doesn't >>> include the userId, which leaves my UserId column null (and no way to get >>> the wishlist back for the user). >>> >>> NHibernate: INSERT INTO Users (First, Last) VALUES (@p0, @p1); select >>> SCOPE_IDENTITY(); @p0 = 'Tim', @p1 = 'Barcz' >>> NHibernate: INSERT INTO WishLists (Name, UserId) VALUES (@p0, @p1); >>> select SCOPE_IDENTITY(); @p0 = 'Sample', @p1 = '' >>> >>> On Tue, Oct 21, 2008 at 10:47 AM, Ayende Rahien <[EMAIL PROTECTED]>wrote: >>> >>>> You need to specify inverse=true >>>> >>>> >>>> On Tue, Oct 21, 2008 at 5:44 PM, Tim Barcz <[EMAIL PROTECTED]> wrote: >>>> >>>>> Ok that's well and good...so I've got unidirectional going on....but am >>>>> seeing strangeness >>>>> >>>>> NHibernate: INSERT INTO Users (First, Last) VALUES (@p0, @p1); select >>>>> SCOPE_IDENTITY(); @p0 = 'Tim', @p1 = 'Barcz' >>>>> NHibernate: INSERT INTO WishLists (Name, UserId) VALUES (@p0, @p1); >>>>> select SCOPE_IDENTITY(); @p0 = 'Sample', @p1 = '' >>>>> NHibernate: UPDATE WishLists SET UserId = @p0 WHERE WishListId = @p1; >>>>> @p0 = '8', @p1 = '1' >>>>> >>>>> Why does this have to be three calls? After the first call, the second >>>>> should have the ID from the first (the userId). The update should be >>>>> unnecessary. >>>>> >>>>> Tim >>>>> >>>>> On Tue, Oct 21, 2008 at 1:40 AM, Gabriel Schenker < >>>>> [EMAIL PROTECTED]> wrote: >>>>> >>>>>> first of all to decrease complexity I would only use uni-directional >>>>>> relations in my domain model (even though in the database any relation is >>>>>> bi-directional) that is, a wishlist does not have to know any thing >>>>>> about a >>>>>> user or about its manager >>>>>> >>>>>> >>>>>> On Mon, Oct 20, 2008 at 11:16 PM, Tim Barcz <[EMAIL PROTECTED]>wrote: >>>>>> >>>>>>> I have a user object and the user can have a number of wishlists. >>>>>>> >>>>>>> Instead of having methods on user (ie. User.AddWishlist, >>>>>>> User.RemoveWishlist), I have a WishListManager which has these methods >>>>>>> on >>>>>>> it. >>>>>>> >>>>>>> Persistent entities include, WishList and WishList item, which relate >>>>>>> back to the user through the WishListManager. >>>>>>> >>>>>>> How would I set up this mapping in NHibernate? Can someone point me >>>>>>> in the right direction? >>>>>>> >>>>>>> Tim >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
