Tushar
Tushar

Reputation: 1176

Broadleaf DemoSite Delete Products

I installed the DemoSite version of Broadleaf. When I try to delete a product from the /admin section. I get the following error message.

org.hibernate.exception.ConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (broadleaf.blc_product, CONSTRAINT FK5B95B7C96D386535 FOREIGN KEY (DEFAULT_SKU_ID) REFERENCES blc_sku (SKU_ID))

I understand that there is a foreign key constraint on SKU table. Shouldn't it auto delete SKU's related whenever I delete a product. Even if not how can I delete the SKU's first. I tried deleting the product options first. But that dint helped either.

Upvotes: 0

Views: 305

Answers (1)

Jitesh Yadav
Jitesh Yadav

Reputation: 419

Quite an old post and don't know how relevant it is to you now but might help others. Apart from this workaround Broadleaf supports soft delete as well instead of hard delete.

You can archive a product and it won't show anywhere in admin & site. I found it useful since at times you might require a product again later on in the future and you can just get it back from archive state if you have soft deleted it.

Broadleaf has a column "ARCHIVED" in table BLC_PRODUCT. You just need to add flag "Y" to it in order to archive a product and later on remove it to recover the product back.

Upvotes: 1

Related Questions