I'm not sure if the actual behavior of the server-side setAllowMultiUpdate() is correct.
I have this:
So having the default setAllowMultiUpdate=false.
This SQL is being produced, IGNORING THE advancedCriteria (since it specifies a field different from the primary key):
So it is deleting THE WHOLE TABLE!!!!!
In the documentation of setAllowMultiUpdate I read:
what? safeguards for server code? I just deleted the whole table having the default of false!! So either the documentation is not accurate or the behavior.
If I change my code to:
Then the correct SQL is generated:
I have this:
Code:
AdvancedCriteria deleteCriterion = new AdvancedCriteria( DefaultOperators.Or, deleteCriterions.toArray(new Criterion[] {})); deleteRequest.setAdvancedCriteria(deleteCriterion); deleteRequest.execute();
This SQL is being produced, IGNORING THE advancedCriteria (since it specifies a field different from the primary key):
Code:
DELETE FROM t_rel_vertrag_bildungsgang WHERE (''1''=''1'') select SCOPE_IDENTITY() AS GENERATED_KEYS
In the documentation of setAllowMultiUpdate I read:
Code:
Sets an internal flag for this DSRequest to determine whether updates and deletes are allowed in the absence of primaryKey fields. The default of false: -provides safeguards for server code
If I change my code to:
Code:
AdvancedCriteria deleteCriterion = new AdvancedCriteria( DefaultOperators.Or, deleteCriterions.toArray(new Criterion[] {})); deleteRequest.setAdvancedCriteria(deleteCriterion); deleteRequest.setAllowMultiUpdate(true); deleteRequest.execute();
Code:
DELETE FROM t_rel_vertrag_bildungsgang WHERE (t_rel_vertrag_bildungsgang.f_vertrag = 8194 AND t_rel_vertrag_bildungsgang.f_vertrag IS NOT NULL) select SCOPE_IDENTITY() AS GENERATED_KEYS
Comment