Cannot delete product in admin
Posted: Thu Mar 13, 2014 7:02 am
Hi,
I try to delete product created by the demo site, it shows the message " There was a problem delete the record" and the exception stack like below. From my understanding, the product should be simply marked as Archived = 'Y', not sure why here it is trying to do hard delete. Any help will be appreciated.
ERROR] 21:49:42 SqlExceptionHelper - Cannot delete or update a parent row: a foreign key constraint fails (`ubestbuyweb`.`blc_product`, CONSTRAINT `FK5B95B7C96D386535` FOREIGN KEY (`DEFAULT_SKU_ID`) REFERENCES `BLC_SKU` (`SKU_ID`))
[ERROR] 21:49:42 DynamicEntityRemoteService - Problem removing org.broadleafcommerce.core.catalog.domain.Product
org.broadleafcommerce.common.exception.ServiceException: Problem removing entity : org.hibernate.exception.ConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`ubestbuyweb`.`blc_product`, CONSTRAINT `FK5B95B7C96D386535` FOREIGN KEY (`DEFAULT_SKU_ID`) REFERENCES `BLC_SKU` (`SKU_ID`))
at org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.remove(BasicPersistenceModule.java:960)
at org.broadleafcommerce.openadmin.server.service.persistence.PersistenceManagerImpl.remove(PersistenceManagerImpl.java:670)
at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService$5.execute(DynamicEntityRemoteService.java:204)
at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService$5.execute(DynamicEntityRemoteService.java:199)
at org.broadleafcommerce.openadmin.server.service.persistence.PersistenceThreadManager.operation(PersistenceThreadManager.java:33)
at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService.remove(DynamicEntityRemoteService.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy173.remove(Unknown Source)
at org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl.remove(AdminEntityServiceImpl.java:660)
at org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl.removeEntity(AdminEntityServiceImpl.java:161)
at org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController.removeEntity(AdminBasicEntityController.java:440)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
......
I try to delete product created by the demo site, it shows the message " There was a problem delete the record" and the exception stack like below. From my understanding, the product should be simply marked as Archived = 'Y', not sure why here it is trying to do hard delete. Any help will be appreciated.
ERROR] 21:49:42 SqlExceptionHelper - Cannot delete or update a parent row: a foreign key constraint fails (`ubestbuyweb`.`blc_product`, CONSTRAINT `FK5B95B7C96D386535` FOREIGN KEY (`DEFAULT_SKU_ID`) REFERENCES `BLC_SKU` (`SKU_ID`))
[ERROR] 21:49:42 DynamicEntityRemoteService - Problem removing org.broadleafcommerce.core.catalog.domain.Product
org.broadleafcommerce.common.exception.ServiceException: Problem removing entity : org.hibernate.exception.ConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`ubestbuyweb`.`blc_product`, CONSTRAINT `FK5B95B7C96D386535` FOREIGN KEY (`DEFAULT_SKU_ID`) REFERENCES `BLC_SKU` (`SKU_ID`))
at org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.remove(BasicPersistenceModule.java:960)
at org.broadleafcommerce.openadmin.server.service.persistence.PersistenceManagerImpl.remove(PersistenceManagerImpl.java:670)
at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService$5.execute(DynamicEntityRemoteService.java:204)
at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService$5.execute(DynamicEntityRemoteService.java:199)
at org.broadleafcommerce.openadmin.server.service.persistence.PersistenceThreadManager.operation(PersistenceThreadManager.java:33)
at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService.remove(DynamicEntityRemoteService.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy173.remove(Unknown Source)
at org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl.remove(AdminEntityServiceImpl.java:660)
at org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl.removeEntity(AdminEntityServiceImpl.java:161)
at org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController.removeEntity(AdminBasicEntityController.java:440)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
......