Ok, so what do you think could prevent NH from doing the DELETE *** IN
(1, 2,  ...)  ?

On 6 avr, 17:44, Fabio Maulo <[email protected]> wrote:
> mmmm you are seeing another movie (the on-delete="cascade" is tested).
>
> 2009/4/6 graphicsxp <[email protected]>
>
>
>
>
>
> > Ok, I had misunderstood.
>
> > I've used hbm2ddl and from what I can see, the generated SQL for
> > creating the tables give me the same database structure. It also adds
> > the correct foreign-primary key constrainsts. The primary key is an
> > identity column, same as my existing DB.
> > Fabio > No triggers is created.
>
> > so it all looks the same. What could explain the fact that I can't
> > have my DELETE grouped in one single query ?
>
> > On 6 avr, 17:22, Fabio Maulo <[email protected]> wrote:
> > > Or if you see a trigger that you don't have in your DB, for another
> > > instance.
>
> > > 2009/4/6 James Crowley <[email protected]>
>
> > > > Fabio doesn't mean throw your old DB out... but if you look at the SQL
> > > > Schema that NHibernate generates based on your mappings, that can
> > generally
> > > > be a good indicator of problems with the mapping that you're using (if
> > you
> > > > start seeing columns you're not expecting, for instance!)
>
> > > > 2009/4/6 graphicsxp <[email protected]>
>
> > > >> er.. no I don't think this is the solution !  My db is well in place
> > > >> and it's there for over three years and I can't re-design anything at
> > > >> this stage.
>
> > > >> Any other suggestions ?
>
> > > >> On 6 avr, 16:45, Fabio Maulo <[email protected]> wrote:
> > > >> > Let NH generate your DB and then see the difference ;)
>
> > > >> > 2009/4/6 graphicsxp <[email protected]>
>
> > > >> > > Thanks. But it's driving me nuts...
>
> > > >> > > I've added on-delete "cascade" and I also have the inverse=true
> > but I
> > > >> > > still get as many DELETE as they are items to delete.
>
> > > >> > > In my Post mapping file :
>
> > > >> > >   <bag  name="Comments" inverse="true" cascade="all-delete-orphan"
> > > >> > > lazy="true">
> > > >> > >      <key column="PostID" on-delete="cascade"/>
> > > >> > >      <one-to-many class="Metrica.CommentPost, Metrica" />
> > > >> > >    </bag>
>
> > > >> > > In my Comment mapping file :
>
> > > >> > > <many-to-one name="thePost" class="Metrica.Post, Metrica"
> > > >> > > column="PostID" not-null="true" />
>
> > > >> > > Is there something wrong with what I'm doing ?
>
> > > >> > > On 6 avr, 16:21, Fabio Maulo <[email protected]> wrote:
> > > >> > > > on-delete="cascade" (attribute of <key> tag)and/or check the
> > > >> inverse.
>
> > > >> > > > 2009/4/6 graphicsxp <[email protected]>
>
> > > >> > > > > Hi,
>
> > > >> > > > > If I remove all the items in my collection and saves my entity
> > to
> > > >> > > > > which the collection belongs, I get one DELETE query per
> > items.
> > > >> > > > > How can I have all these items deleted with the same DELETE
> > query
> > > >> > > > > using something like :
>
> > > >> > > > > DELETE FROM myTable WHERE id IN (1, 2, 3 , ... )
>
> > > >> > > > > Thanks
>
> > > >> > > > --
> > > >> > > > Fabio Maulo
>
> > > >> > --
> > > >> > Fabio Maulo
>
> > > > --
> > > > James Crowley
> > > > Managing Director
> > > > Developer Fusion - Connecting developers worldwide
>
> > > > Developer Fusion Ltd | 58 Sandringham Close | Enfield, EN1 3JH
> > > > mob: 07986 624128 web:http://www.developerfusion.com/
>
> > > --
> > > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to