简体   繁体   中英

Hybris Remove Uniqueness of an existing attribute

I am planning to remove the uniqueness of an attribute,

'name[unique=true]'

Planning to remove the unique=true so that data(name) that are the same wont be saved twice.

I tried to removed it from spring.xml file but it didn't work. Anyone knows what are the other files to be modified?

How can I make the existing unique attribute to be 'non-unique'?

Uniqueness is a property in the *-items.xml of your custom extension. I strongly encourage you to read the documentation about this file in the official SAP Hybris documentation . Be careful that you shouldn't change uniqueness of Hybris' default attributes as I may have impact of the core system functionality.

You should see something similar to this. Please note the unique="true" modifier in the attribute.

<itemtype code="Product" autocreate="false" generate="false">
  <attributes>
    <attribute qualifier="myUniqueAttribute" type="java.lang.String">
      <persistence type="property" />
      <modifiers optional="false" initial="false" unique="true" />
    </attribute>
  </attributes>
</itemtype>

However, after making the change in the data model (extension-items.xml file), you should always run a system update. Be aware that some changes must be performed manually as for example, hybris never removes fields from the DB once created.

Is this change in one of your custom model, or in a hybris default one ?

(Edited after some refinement of the question in the comments)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM