Fixed
I'm calling a MySQL REST API from a B4J WebApp.
When trying to figure this out it seemed to be the only solution that made sense with my approach
Perhaps some background. I have organizations and products. I have a table that links organizations to products. This is done initially when one registers an organization.
CREATE TABLE `organization_products` (
`organization_id` smallint(5) unsigned NOT NULL DEFAULT '0',
`organization_productid` tinyint(3) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`organization_id`,`organization_productid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
So what happens is, when a person selects 1..n products for an organization, the links are kept here. If for example, a person removes the products, a delete of all products linked to that organization should take place.
If products are updated / new products are added, a delete happens anyways and then an insert happens. So I inserted a Sleep between the Delete & Inserts, because for some reason the insert happen and then the deletes follows.
293