Ah... Niclas...If you are using Identity, as POID generator, take care with session.Persist because this is only another part of the never ending story (what mean "find the ID" when Identity is used as strategy ?).
2009/6/22 Fabio Maulo <[email protected]> > 2009/6/22 Niclas Pehrsson <[email protected]> > >> My question is if I can get NHibernate to check with an select query >> before any new insert or update if there exist any row/object with the >> given Id and depending on the answer uses insert or update. >> > > Forget it! > You can force NH to do a select before update (by mapping) you can use the > unsaved-value (by mapping) but you can pretty sure we will never implements > a select before insert only to check if an id exist. > The POID (Persistent object ID), when you choose "assigned", is under your > resposibility. > > I know this is an really ugly solution if you look at performance >> cause one insert gives one select and gives us N^2 selects but I like >> it more than using the code everywhere so I can save the rootObject >> more "atomic". > > >>Any other solutions are welcome. > > Use a no business meaning POID an let NH or the DB generate it. > If the problem is only because you need all ID when you save the root > entity you can use session.Persist. > -- > Fabio Maulo > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
