Does anyone know if there is any way to stop NHibernate performing
selects when using POID = "assigned"?
On Feb 6, 9:57 pm, Billy Stack <
bs.st...@gmail.com> wrote:
> Found out the issue.
> I was manually setting the Id of the OrderItem entity when the POID was
> guid.comb. Changed the code to no longer set the Id and all worked as
> expected.
>
> Still needed inverse="true" in child collection definition as otherwise
> UPDATE statements (in the OrderItem table) were being generated.
>
> Thanks for the help. NHibernate can work with event sourcing!
>
> Billy Stack
>
> On Sun, Feb 6, 2011 at 3:26 PM, Richard Brown (gmail) <
>
>
>
>
fluke...@googlemail.com> wrote:
> > That should be fairly straightforward to do. I’d need to see your
> > mappings and code to see what’s wrong in this case, but I suspect it’ll be
> > that you want to use inverse=”true” on the collection (if you’re setting the
> > back-pointer from the child to the parent yourself).
>
> > *From:* Billy Stack <
bs.st...@gmail.com>
> > *Sent:* Sunday, February 06, 2011 1:51 PM
> > *To:*
nhu...@googlegroups.com
> > *Subject:* Re: [nhusers] Re: [NH users] Re: When using id generator
> >>
http://groups.google.com/group/nhibernate-development/browse_thread/t...
>
> >> Regards,
> >> Richard
>
> >> *From:* Billy Stack <
bs.st...@gmail.com>
> >> *Sent:* Sunday, February 06, 2011 9:29 AM
> >> *To:*
nhu...@googlegroups.com
> >> *Subject:* Re: [nhusers] Re: When using id generator class="assigned",
> >> why does extra select take place
> >> The Id for the entity we were generating was a comb guid. Rather than
> >> the code setting this we just changed the id generator to "guid.comb". No
> >> select is performed by NHibernate by default when we perform a save.
>
> >> Thanks for the help
> >> Billy Stack
>
> >> On Sat, Feb 5, 2011 at 3:10 PM, Jason Meckley <
jasonmeck...@gmail.com>wrote:
>
> >>> this worked in my situation, but the entities I was saving where
> >>> children of a parent entity that was resolved from session. so the context
> >>> is slightly different. In your situation it sounds like the entity with the
> >>> assigned id is the root.
>
> >>> You know it's an insert only model, but NH doesn't know that, so it needs
> >>> to check if it exists. There may be a mapping/configuration setting that
> >>> prevents load before save, or prevents updates, but I not 100% sure about
> >>> that.
>
> >>> If that doesn't work (or exist) I would change the POID strategy to allow
> >>> NH/DB to handle it. If the assigned ID has business meaning, then map this
> >>> as an immutable attribute of the entity.
>
> >>> Another option is to drop the use of NH altogether. I haven't used event
> >>> sourcing myself, but what little I understand it suppose to simplify
> >>> persistence concerns. If that's the case then NH or an RDBMS wouldn't be
> >>> required.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "nhusers" group.
> >>> To post to this group, send email to
nhu...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> mailto:
nhusers%2Bunsu...@googlegroups.com<nhusers%2Bunsubscribe@googleg
roups.com>.
> >> mailto:
nhusers%2Bunsu...@googlegroups.com<nhusers%2Bunsubscribe@googleg
roups.com>
> >> .
> >> mailto:
nhusers%2Bunsu...@googlegroups.com<nhusers%2Bunsubscribe@googleg
roups.com>
> >> .
> >
http://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>
> - Show quoted text -