JCR node exception

Hi, I have 100 existing products in my system. There is a node called ProductType(which is a string). Now I converted the field to array inside my Product.java bean like below.

@HippoEssentialsGenerated(internalName = “demo:ProductType”)
public String getProductType() {
return getMultipleProperty(“demo:ProductType”);
}

While updating the product JSON, I am getting the exception below.

javax.jcr.ValueFormatException: Single-valued property can not be set to an array of values:property /content/documents/demo/products/3/1/532511/532511[2]/demo:ProductType

Here is my code

Value multiValues = new Value { valueFactory.createValue(entry.getValue()),
valueFactory.createValue(“Value”) };
parentNode.setProperty(“demo:ProductType”, multiValues);

Here is my sample JSON structure

{
“attributes”: {
“PRODUCT_TYPE”: “Value1”
}
}

Here is my document type structure

image

Hi @K_Prasad,

you will need to convert existing properties into multi-value properties, either manually or via groovy script:

Hello @machak , Thanks for reply. I will check