No worries thanks Fabio, I still feel like an idiot for posting a
wrong solution but hey I am only human :).



Cheers
Stefan

On Fri, Nov 14, 2008 at 12:11 PM, Fabio Maulo <[EMAIL PROTECTED]> wrote:
> Hi Stefan.
> Thanks for the wiki in NHForge.
> Only a note for who want write a wiki...
> You can use WLW in your PC  and than copy&paste the HTML.
> 2008/11/13 Stefan Sedich <[EMAIL PROTECTED]>
>>
>> Back to a unique foreign key mapping with a many to one to get this to
>> work :\, what I originally had but insisted on the one to one, this
>> works fine.
>>
>>
>> Updated my posts to reflect my failure :). Key for next time MAKE SURE
>> I RUN ALL MY TESTS FIRST!!!
>>
>>
>> Cheers
>>
>> On Fri, Nov 14, 2008 at 9:24 AM, Stefan Sedich <[EMAIL PROTECTED]>
>> wrote:
>> > Looks like this is an EPIC fail, inserts seem not to work :\, I
>> > thought I had tried this but when I got to work this morning and re
>> > ran my rest:
>> >
>> > NHibernate.Id.IdentifierGenerationException: null id generated
>> > for:NHibernateDocumentTest.DocumentFile
>> >
>> >
>> > Looks like it is back to the drawing board.
>> >
>> >
>> > Fun fun fun
>> >
>> > On Thu, Nov 13, 2008 at 10:04 PM, Stefan Sedich
>> > <[EMAIL PROTECTED]> wrote:
>> >> Not a problem glad my heart ache might help someone in the future,
>> >> look forward to contributing more.
>> >>
>> >>
>> >> Cheers
>> >>
>> >> On Thu, Nov 13, 2008 at 10:00 PM, Tuna Toksöz <[EMAIL PROTECTED]>
>> >> wrote:
>> >>> Thanks, Stefan! We really appreciate your help on blogging.
>> >>>
>> >>> On Thu, Nov 13, 2008 at 2:58 PM, Stefan Sedich
>> >>> <[EMAIL PROTECTED]>
>> >>> wrote:
>> >>>>
>> >>>> Ok whipped this one up just then :), hopefully it makes sense to
>> >>>> someone
>> >>>> else.
>> >>>>
>> >>>>
>> >>>>
>> >>>> http://weblogs.asp.net/stefansedich/archive/2008/11/13/lazy-loaded-one-to-one-with-nhibernate.aspx
>> >>>>
>> >>>>
>> >>>> Cheers
>> >>>>
>> >>>> On Thu, Nov 13, 2008 at 9:46 PM, Stefan Sedich
>> >>>> <[EMAIL PROTECTED]>
>> >>>> wrote:
>> >>>> > Yep will be blogging about this tonight :), hopefully save someone
>> >>>> > else some frustration. Infact I will do it right away.
>> >>>> >
>> >>>> > On Thu, Nov 13, 2008 at 9:45 PM, Tuna Toksöz <[EMAIL PROTECTED]>
>> >>>> > wrote:
>> >>>> >> A post from you would be welcome ! :) hahaha :)
>> >>>> >>
>> >>>> >> On Thu, Nov 13, 2008 at 2:41 PM, Stefan Sedich
>> >>>> >> <[EMAIL PROTECTED]>
>> >>>> >> wrote:
>> >>>> >>>
>> >>>> >>> Yep thanks Tuna the answer was there all along, supprised I only
>> >>>> >>> found
>> >>>> >>> this on 1 site :\ would have thought more people have
>> >>>> >>> done/blogged
>> >>>> >>> about this before.
>> >>>> >>>
>> >>>> >>> Ohh well time for a beer.
>> >>>> >>>
>> >>>> >>>
>> >>>> >>> Cheers
>> >>>> >>>
>> >>>> >>> On Thu, Nov 13, 2008 at 9:38 PM, Tuna Toksöz <[EMAIL PROTECTED]>
>> >>>> >>> wrote:
>> >>>> >>> > From the forum, I see that
>> >>>> >>> >
>> >>>> >>> >
>> >>>> >>> > But now imagine your B object may or may not have associated C
>> >>>> >>> > (constrained="false"). What should getCee() return when
>> >>>> >>> > specific B
>> >>>> >>> > does
>> >>>> >>> > not
>> >>>> >>> > have C? Null. But remember, Hibernate must set correct value of
>> >>>> >>> > "cee" at
>> >>>> >>> > the
>> >>>> >>> > moment it set B (because it does no know when someone will call
>> >>>> >>> > getCee()).
>> >>>> >>> > Proxy does not help here because proxy itself in already
>> >>>> >>> > non-null
>> >>>> >>> > object.
>> >>>> >>> >
>> >>>> >>> > So the resume: if your B->C mapping is mandatory
>> >>>> >>> > (constrainted=true),
>> >>>> >>> > Hibernate will use proxy for C resulting in lazy
>> >>>> >>> > initialization. But
>> >>>> >>> > if
>> >>>> >>> > you
>> >>>> >>> > allow B without C, Hibernate just HAS TO check presence of C at
>> >>>> >>> > the
>> >>>> >>> > moment
>> >>>> >>> > it loads B. But a SELECT to check presence is just inefficient
>> >>>> >>> > because
>> >>>> >>> > the
>> >>>> >>> > same SELECT may not just check presence, but load entire
>> >>>> >>> > object. So
>> >>>> >>> > lazy
>> >>>> >>> > loading goes away.
>> >>>> >>> >
>> >>>> >>> > On Thu, Nov 13, 2008 at 2:34 PM, Stefan Sedich
>> >>>> >>> > <[EMAIL PROTECTED]>
>> >>>> >>> > wrote:
>> >>>> >>> >>
>> >>>> >>> >> Final try:
>> >>>> >>> >>
>> >>>> >>> >> <one-to-one name="DocumentFile" cascade="all-delete-orphan"
>> >>>> >>> >> lazy="proxy" constrained="true" />
>> >>>> >>> >>
>> >>>> >>> >> WORKS!!! Why is this the case can anyone shed some light why
>> >>>> >>> >> constrained="true" on the Document worked?
>> >>>> >>> >>
>> >>>> >>> >> On Thu, Nov 13, 2008 at 9:28 PM, Stefan Sedich
>> >>>> >>> >> <[EMAIL PROTECTED]>
>> >>>> >>> >> wrote:
>> >>>> >>> >> > Arggggggggggg I was wrong this does not work. Seriously if I
>> >>>> >>> >> > could
>> >>>> >>> >> > throw NH out the window right now I would hehe. :\
>> >>>> >>> >> >
>> >>>> >>> >> > On Thu, Nov 13, 2008 at 9:25 PM, Fabio Maulo
>> >>>> >>> >> > <[EMAIL PROTECTED]>
>> >>>> >>> >> > wrote:
>> >>>> >>> >> >> property lazynees is not supported in NH basically because
>> >>>> >>> >> >> we
>> >>>> >>> >> >> need
>> >>>> >>> >> >> FieldInterceptors (AFIK not experimented in .NET)
>> >>>> >>> >> >>
>> >>>> >>> >> >> 2008/11/13 codemonkey <[EMAIL PROTECTED]>
>> >>>> >>> >> >>>
>> >>>> >>> >> >>> Is this possible in NH? I have googled forever and cannot
>> >>>> >>> >> >>> find
>> >>>> >>> >> >>> any
>> >>>> >>> >> >>> info at all? My only option it seems is to use a seperate
>> >>>> >>> >> >>> table
>> >>>> >>> >> >>> to
>> >>>> >>> >> >>> my
>> >>>> >>> >> >>> image and map using a one-to-one with lazy set tot true.
>> >>>> >>> >> >>>
>> >>>> >>> >> >>> Any advice would be good..
>> >>>> >>> >> >>>
>> >>>> >>> >> >>>
>> >>>> >>> >> >>> Cheers
>> >>>> >>> >> >>> Stefan
>> >>>> >>> >> >>>
>> >>>> >>> >> >>
>> >>>> >>> >> >>
>> >>>> >>> >> >>
>> >>>> >>> >> >> --
>> >>>> >>> >> >> Fabio Maulo
>> >>>> >>> >> >>
>> >>>> >>> >> >> >>
>> >>>> >>> >> >>
>> >>>> >>> >> >
>> >>>> >>> >> >
>> >>>> >>> >> >
>> >>>> >>> >> > --
>> >>>> >>> >> > Stefan Sedich
>> >>>> >>> >> > Software Developer
>> >>>> >>> >> > http://weblogs.asp.net/stefansedich
>> >>>> >>> >> >
>> >>>> >>> >>
>> >>>> >>> >>
>> >>>> >>> >>
>> >>>> >>> >> --
>> >>>> >>> >> Stefan Sedich
>> >>>> >>> >> Software Developer
>> >>>> >>> >> http://weblogs.asp.net/stefansedich
>> >>>> >>> >>
>> >>>> >>> >>
>> >>>> >>> >
>> >>>> >>> >
>> >>>> >>> >
>> >>>> >>> > --
>> >>>> >>> > Tuna Toksöz
>> >>>> >>> >
>> >>>> >>> > Typos included to enhance the readers attention!
>> >>>> >>> >
>> >>>> >>> > >
>> >>>> >>> >
>> >>>> >>>
>> >>>> >>>
>> >>>> >>>
>> >>>> >>> --
>> >>>> >>> Stefan Sedich
>> >>>> >>> Software Developer
>> >>>> >>> http://weblogs.asp.net/stefansedich
>> >>>> >>>
>> >>>> >>>
>> >>>> >>
>> >>>> >>
>> >>>> >>
>> >>>> >> --
>> >>>> >> Tuna Toksöz
>> >>>> >>
>> >>>> >> Typos included to enhance the readers attention!
>> >>>> >>
>> >>>> >> >>
>> >>>> >>
>> >>>> >
>> >>>> >
>> >>>> >
>> >>>> > --
>> >>>> > Stefan Sedich
>> >>>> > Software Developer
>> >>>> > http://weblogs.asp.net/stefansedich
>> >>>> >
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> Stefan Sedich
>> >>>> Software Developer
>> >>>> http://weblogs.asp.net/stefansedich
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Tuna Toksöz
>> >>>
>> >>> Typos included to enhance the readers attention!
>> >>>
>> >>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Stefan Sedich
>> >> Software Developer
>> >> http://weblogs.asp.net/stefansedich
>> >>
>> >
>> >
>> >
>> > --
>> > Stefan Sedich
>> > Software Developer
>> > http://weblogs.asp.net/stefansedich
>> >
>>
>>
>>
>> --
>> Stefan Sedich
>> Software Developer
>> http://weblogs.asp.net/stefansedich
>>
>>
>
>
>
> --
> Fabio Maulo
>
> >
>



-- 
Stefan Sedich
Software Developer
http://weblogs.asp.net/stefansedich

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