Page 1 of 1

bug while adding product media from admin webapp

Posted: Tue May 13, 2014 6:39 am
by mohitrathod
blc.version 3.0.5-GA

steps to reproduce


1) create a new product and save it

2) add media from media tab with key "Primary" and save it

3) now add "Primary Image" from General Tab.

it will throw Duplicate entry '759368-primary' for key 'PRIMARY' exceptions


[ WARN] 15:35:20 SqlExceptionHelper - SQL Error: 1062, SQLState: 23000
[ERROR] 15:35:20 SqlExceptionHelper - Duplicate entry '759368-primary' for key 'PRIMARY'
[ERROR] 15:35:20 DynamicEntityRemoteService - Problem updating org.broadleafcommerce.core.catalog.domain.Product
org.broadleafcommerce.common.exception.ServiceException: Unable to update entity for org.broadleafcommerce.core.catalog.domain.ProductImpl
at org.broadleafcommerce.admin.server.service.handler.ProductCustomPersistenceHandler.update(ProductCustomPersistenceHandler.java:135)
at org.broadleafcommerce.openadmin.server.service.persistence.PersistenceManagerImpl.update(PersistenceManagerImpl.java:380)
at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService.update(DynamicEntityRemoteService.java:170)
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)

Re: bug while adding product media from admin webapp

Posted: Tue May 13, 2014 12:15 pm
by phillipuniverse
Check the value of MediaImpl in the SEQUENCE_GENERATOR table and then also the maximum value of the primary key in BLC_MEDIA. The value in SEQUENCE_GENERATOR should be 100 more than the maximum primary key value.

We have a utility that can detect this for you if you enable the detect.sequence.generator.inconsistencies system property. It will spit out the tables that are in error. The tool can also fix problems automatically with the auto.correct.sequence.generator.inconsistencies system property. So in something like development.properties:

Code: Select all

detect.sequence.generator.inconsistencies=true
auto.correct.sequence.generator.inconsistencies=true

Re: bug while adding product media from admin webapp

Posted: Wed May 14, 2014 3:07 am
by mohitrathod
Hello Phillip,

thanks for quick reply :)

sorry if it is misleading.

admin application gives an error if we add image from media tab with "primary" key that "primary is reserved key for system"

but when we provide "Primary" as a key ("P" in caps) then it saves the image from media tab and then if you add actual primary image from General Tab then it shows this error.

this bug is not related to sequence generator :)

Re: bug while adding product media from admin webapp

Posted: Wed May 14, 2014 10:26 am
by phillipuniverse
Ah ha; I understand now. The primary image is actually displayed by itself on the form where it says Primary Image: http://cl.ly/image/251x1p3I2l3d

Re: bug while adding product media from admin webapp

Posted: Tue May 20, 2014 10:04 am
by mohitrathod
Hello Phillip,

this isn't happening with us, when we follow below steps

1) create a new product and save it (don't add primary image for now)

2) add media from media tab with key "Primary" and save it

3) now add "Primary Image" from General Tab.


when i perform step 3 and save the product after adding image it gives me blank page and exception in logs