Page 1 of 1

Products removed from Admin are not removed from the db

Posted: Sun Oct 20, 2013 4:34 am
by jayhuang
Hi,

In the demo app, I removed all the pre-installed catalogs and then products from the admin console, all actions were successful based on the ui feedbacks, but the products are still showing on the shop website, and the entries in blc_product table are not removed at all. In addition, after removing the products, removing product options "Shirt Color" and "Shirt Size" throws errors,


Code: Select all

Problem accessing /admin/product-options/1/delete. Reason:

    Problem removing entity : org.hibernate.exception.ConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`broadleaf`.`blc_sku_option_value_xref`, CONSTRAINT `FK7B61DC0BB0C16A73` FOREIGN KEY (`PRODUCT_OPTION_VALUE_ID`) REFERENCES `blc_product_option_value` (`PRODUCT_OPTION_VALUE_ID`))

Caused by:

org.broadleafcommerce.common.exception.ServiceException: Problem removing entity : org.hibernate.exception.ConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`broadleaf`.`blc_sku_option_value_xref`, CONSTRAINT `FK7B61DC0BB0C16A73` FOREIGN KEY (`PRODUCT_OPTION_VALUE_ID`) REFERENCES `blc_product_option_value` (`PRODUCT_OPTION_VALUE_ID`))
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
   at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService.recreateSpecificServiceException(DynamicEntityRemoteService.java:76)
   at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService.remove(DynamicEntityRemoteService.java:193)
   at sun.reflect.GeneratedMethodAccessor238.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)



Everything was done through the admin console, no manual database modifications.



I am on version 3.0-GA

Thanks.

Jay

Re: Products removed from Admin are not removed from the db

Posted: Sun Oct 20, 2013 11:34 pm
by phillipuniverse
The entities will not be removed from the database but instead will change the 'archived' property to Y.

Changes will not reflect on the frontend immediately as Solr will have to rebuild its index.

Can you open an issue at https://github.com/BroadleafCommerce/BroadleafCommerce for the stack trace? I believe that this will be resolved as apart of a larger task to remove these foreign key exceptions bubbling up through the admin but it will be useful to track these individual cases.

Re: Products removed from Admin are not removed from the db

Posted: Mon Oct 21, 2013 3:11 am
by jayhuang
Hi phillipuniverse,

Thanks for the explainations. I've raised a ticket at

https://github.com/BroadleafCommerce/Br ... issues/456

Cheers