I'm a little confused over your mapping of table to class but,
assuming you meant TABLE_A relates to class A and TABLE_B relates to
class B, your example would therefore be:
DELETE FROM TABLE_B WHERE CHILDREN_ID IN (1, 2, 3) - Children_id is
the primary key
Correct?
If so, then If you're
Yes but that would delete all of the children for a given parent !
What if I only want to delete a few of them ? The IN would still be
appropriate and would be :
DELETE FROM TABLE_B WHERE CHILDREN_ID IN (1, 2, 3)
On 8 avr, 12:02, Graham Bunce grahambu...@hotmail.com wrote:
I'm a little
If you only wanted to delete a few then, yes you are correct. However,
how many is a few before the IN becomes extremely long?. I don't
know if there are any performance hits for a large number of IN
statements. If there is, I presume this would be different for each
database type. Could
Ok, so it's not possible to do what I want, that's all I wanted to
know. I will add the JIRA request.
Regarding the batch thing, I was told I can't do it when doing an
INSERT because my table has a identity field. Is it true for DELETE
as well ?
On 6 avr, 22:13, Fabio Maulo
I'll reply to myself
I've used NHProfiler (really good tool : ) ) and I can see the DELETE
are batched according to the value in property
name=adonet.batch_size5/property
I've created the JIRA request for the IN thing.
Thanks to all !
On 7 avr, 09:40, graphicsxp graphic...@googlemail.com
on-delete=cascade (attribute of key tag)and/or check the inverse.
2009/4/6 graphicsxp graphic...@googlemail.com
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
Let NH generate your DB and then see the difference ;)
2009/4/6 graphicsxp graphic...@googlemail.com
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 :
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
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
you are seeing another movie (the on-delete=cascade is tested).
2009/4/6 graphicsxp graphic...@googlemail.com
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
Ok, so what do you think could prevent NH from doing the DELETE *** IN
(1, 2, ...) ?
On 6 avr, 17:44, Fabio Maulo fabioma...@gmail.com wrote:
you are seeing another movie (the on-delete=cascade is tested).
2009/4/6 graphicsxp graphic...@googlemail.com
Ok, I had misunderstood.
I think you have the same problem I had NH will not (as I
understand it) generate a single DELETE FROM entity WHERE foreignkey =
X. From my tests it will work out the keys of the child table and
delete them all one-by-one, i.e. DELETE FROM entity WHERE primarykey =
Y, where NH has already got
If what you are looking for is only one round trip you can obtain the same
result configuringproperty name=adonet.batch_size100/property
If you want exactly
DELETE FROM TABLE_A WHERE CHILDREN_ID IN (1, 2, 3)
you should add a Improvement request in our JIRA.
2009/4/6 graphicsxp
13 matches
Mail list logo