Please create a test case for this On Tue, Oct 21, 2008 at 5:57 PM, 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 -~----------~----~----~----~------~----~------~--~---
