У меня есть динамическое перечисление, ManufacturerName. Я должен сделать возможным добавить новое значение (нового производителя). Я пробовал это, но выдает ошибку.
public void createNewManufacturerEnum(final String code, final String name)
{
try
{
final HybrisEnumValue manufacturer =ManufacturerName.valueOf(code);
enumerationService.setEnumerationName(manufacturer, name, Locale.GERMAN);
enumerationService.setEnumerationName(manufacturer, name, Locale.ENGLISH);
...
Ошибка:
Caused by: de.hybris.platform.servicelayer.exceptions.ModelSavingException: [com.cancom.core.manufacturer.CCManufNameInterceptor@907afc5]: unexpected validator error: missing persistent item for enum value 0000505008
at de.hybris.platform.servicelayer.internal.model.impl.wrapper.ModelWrapper.invokeValidateInterceptors(ModelWrapper.java:311) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.wrapper.ModelWrapper.validate(ModelWrapper.java:239) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.extractor.impl.DefaultModelExtractor.process(DefaultModelExtractor.java:58) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.performPersistenceOperations(DefaultModelService.java:711) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAllInternal(DefaultModelService.java:706) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAll(DefaultModelService.java:686) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAll(DefaultModelService.java:648) ~[coreserver.jar:?]
at com.hybris.backoffice.cockpitng.dataaccess.facades.object.DefaultPlatformObjectFacadeStrategy.save(DefaultPlatformObjectFacadeStrategy.java:137) ~[classes/:?]
... 92 more
Caused by: java.lang.IllegalStateException: missing persistent item for enum value 0000505008
at de.hybris.platform.servicelayer.internal.converter.impl.EnumValueModelConverter.getSource(EnumValueModelConverter.java:154) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.getSource(DefaultModelService.java:431) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.type.impl.DefaultTypeService.getEnumerationValue(DefaultTypeService.java:330) ~[coreserver.jar:?]
at de.hybris.platform.enumeration.impl.DefaultEnumerationService.setEnumerationName(DefaultEnumerationService.java:180) ~[coreserver.jar:?]
at com.cancom.core.manufacturer.dao.impl.CCManufNameDaoImpl.createNewManufacturerEnum(CCManufNameDaoImpl.java:73) ~[classes/:?]
at com.cancom.core.manufacturer.services.impl.CCManufNameServiceImpl.createNewEnum(CCManufNameServiceImpl.java:37) ~[classes/:?]
at com.cancom.core.manufacturer.CCManufNameInterceptor.onValidate(CCManufNameInterceptor.java:66) ~[classes/:?]
at com.cancom.core.manufacturer.CCManufNameInterceptor.onValidate(CCManufNameInterceptor.java:1) ~[classes/:?]
at de.hybris.platform.servicelayer.internal.model.impl.wrapper.ModelWrapper.invokeValidateInterceptors(ModelWrapper.java:291) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.wrapper.ModelWrapper.validate(ModelWrapper.java:239) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.extractor.impl.DefaultModelExtractor.process(DefaultModelExtractor.java:58) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.performPersistenceOperations(DefaultModelService.java:711) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAllInternal(DefaultModelService.java:706) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAll(DefaultModelService.java:686) ~[coreserver.jar:?]
at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.saveAll(DefaultModelService.java:648) ~[coreserver.jar:?]
at com.hybris.backoffice.cockpitng.dataaccess.facades.object.DefaultPlatformObjectFacadeStrategy.save(DefaultPlatformObjectFacadeStrategy.java:137) ~[classes/:?]
... 92 more
Что я делаю не так? Спасибо!