Define Data Types

Define types and relationships between types using xml in <extension-name>-items.xml files located in the resource folder of each extension.

Best Practice Guidelines

SAP recommends these guidelines for software developers extending SAP Commerce Cloud.

For information on ItemType attributes, see References.

Define a deployment table for all Item Types extending GenericItem.
All types that explicitly or implicitly (because it's the default) have GenericItem as their direct super type should have their own deployment.
Failing to declare a deployment for a type means that all instances of that type are stored in the genericitems table with all the other types that have no deployment table. This table can become very large in terms of rows, columns, as well as indexes. Columns are added for each attribute of the types stored in this table. Each item of any type stored in the table takes up a separate row, and each different type stored in this way adds the usual indexes for the table.
This makes the database work inefficiently causing performance issues. In addition, fixing this issue in a production environment requires a data migration script. See the following example:
<itemtype code="PaymentInfo" extends="GenericItem"
          ...
          autocreate="true" generate="true">
    <deployment table="PaymentInfos" typecode="42"/> <!-- deployment defined here before attributes -->
    <attributes>
        ...
    </attributes>
</itemtype>
The only exception to this rule is an abstract item type where you want concrete subtypes stored in separate tables:
<itemtype code="AbstractOrder" extends="GenericItem"
          ...
          autocreate="true" generate="true">
    <!-- No deployment defined here -->
        ...
</itemtype>
<itemtype code="Cart" extends="AbstractOrder"
          ...
          autocreate="true" generate="true">
    <deployment table="Carts" typecode="43"/> <!-- Deployment!!! -->
    ...
 </itemtype>
<itemtype code="Order" extends="AbstractOrder"
          ...
          autocreate="true" generate="true">
    <deployment table="Orders" typecode="45" ... /> <!-- Deployment!!! -->
    ...
 </itemtype>
Do not define a deployment table for any Item Types that already have a deployment inherited from a super type.
If your Item Type directly or indirectly extends another Item Type that defines a deployment, unless that other Item Type is GenericItem, then defining a deployment table for your Item Type, although possible, isn't recommended. It can cause serious performance issues because queries for the super type require a UNION clause with the new table. The following displays an example:
<itemtype code="MyMedia" extends="Media" autocreate="true" generate="true">
<deployment table="mymedia" typecode="22222"/>  <!-- deployment should NOT be defined -->
<attributes>
...
</attributes>
</itemtype>
SELECT {PK} FROM {Media} WHERE {code}=?code UNION SELECT {PK} FROM {MyMedia} WHERE {code}=?code
Deployment type codes must be greater than 10000.
Type codes in deployment clauses up to 10000 are reserved for types defined within the SAP Commerce Cloud product.
In other words, developers defining new item types for inclusion in the product must select a type code below 10000 and register that in the file, reservedTypecodes TXT file. Once released as part of the product, entries must not be removed from the reservedTypecodes TXT file.
Developers creating types for customer implementation projects or reusable assets that aren’t shipped as part of the product must select a type code greater than 10000 that isn't listed in the few exceptional reserved numbers above 10000. See Specifying a Deployment for Platform Types for more details. Otherwise, there's a strong possibility of causing a conflict with a system type code if you use a value less than 10000. Even if there are no conflicts with the current version of the product and the extensions currently being used, an upgrade to a newer version of SAP Commerce Cloud, or the addition of extra extensions from the product could subsequently cause a type code conflict. The following displays an example:
<itemtype code="MyCustomProjectType" extends="GenericItem" autocreate="true" generate="true">
<deployment table="mycustomprojecttype" typecode="967"/>  <!-- deployment typecode should be greater than 10000 -->
<attributes>
...
</attributes>
</itemtype>
Do not define a Jalo class if you are adding to an existing type.
If you're adding to an item type already defined elsewhere, do not specify a non-default Jalo class.
<itemtype code="Product" autocreate="false" generate="false" jaloclass="com.hybris.product.jalo.MyProduct">  
<!-- violation here, the type Product already has a jaloclass -->
<attributes>
...
</attributes>
</itemtype>
In general, unless you have good reasons to specify a different class name, omit the Jalo class clause from all item type definitions and let the system use the default value for the class name.
Define a deployment table for all many-to-many relations.
If a many-to-many relation doesn't define a deployment table, its data is stored in the links table along with the data from all the other many-to-many relations that don't define a deployment table. This can cause that table to have a very large number of rows, large indexes, and encounter able locks during inserts or updates or deletes. This can have a serious impact on performance.
For one-to-many relations, it's not possible to define an own deployment because they aren't modeled as own table at database at all. The following displays an example:
<relation code="PrincipalGroupRelation" autocreate="true" generate="false" localized="false"
            deployment="de.hybris.platform.persistence.link.PrincipalGroupRelation"> <!-- Deployment needed -->
      <sourceElement qualifier="members" type="Principal" cardinality="many" ... >
          <modifiers read="true" writ'se="true" search="true" optional="true"/>
      </sourceElement>
      <targetElement qualifier="groups" type="PrincipalGroup" cardinality="many" ... >
          <modifiers read="true" write="true" search="true" optional="true"/>
      </targetElement>
  </relation>
Do not define attributes with a persistence type of cmp.
The cmp persistence mode is deprecated and must not be used.
<itemtype code="MyProduct" extends="Product" autocreate="true" generate="true">
<attributes>
     <attribute qualifier="myAttribute" type="java.lang.String">
          <persistence type="cmp"/>  <!-- should only use property or dynamic -->
     </attribute>
 </attributes>
</itemtype>
Ensure mandatory fields (where optional='false') have either initial set to true or a default value defined.
This ensures data consistency on the Type System level. Also note that if you set a default value in the items XML file, the default value is persisted for newly created items only. Existing data isn't updated. The following displays an example:
...   
<!-- optional set to false so initial set to true -->             
<attribute autocreate="true" qualifier="paymentInfoType" type="ComposedType" generate="true">
    <persistence type="property"/>
    <modifiers read="true" write="true" search="true" initial="true" optional="false"/> 
    ...
 
 
<!-- optional set to false so defaultValue provided -->             
<attribute autocreate="true" qualifier="global" type="java.lang.Boolean" generate="true">
    <defaultvalue>Boolean.FALSE</defaultvalue>
    <persistence type="property"/>
    <modifiers read="true" write="true" search="true" optional="false"/>
    ...
Ensure immutable fields (where write='false') have initial set to true.
Setting write="false" means that a value can only be set when an Item is first created. Setting initial="true" effectively achieves the same. For consistency, set initial="true" when write="false". The following displays an example:
<itemtype code="Quote" extends="AbstractOrder" jaloclass="de.hybris.platform.jalo.order.Quote"
          autocreate="true" generate="true">
     <deployment table="Quotes" typecode="60" propertytable="QuoteProps"/>
     <attributes>
         <attribute autocreate="true" qualifier="version" type="java.lang.Integer">
             <description>The version of the quote. Along with code it makes a quote instance unique.
             </description>
             <!-- write set to false so initial set to true -->            
             <modifiers initial="true" write="false" optional="false" unique="true"/>
             <persistence type="property"/>
         </attribute>
    ...
Define Boolean attributes as mandatory.
It's possible to store 3 values for a Boolean attribute (true, false, or null). Storing a null is almost always not the desired outcome and is usually mapped to a true or false value. It's possible that the mapping isn't always in place so there's potential for logic errors or NullPointerExceptions. The following displays an example:
<!-- Boolean attribute so optional set to false -->            
<attribute autocreate="true" qualifier="global" type="java.lang.Boolean" generate="true">
    <defaultvalue>Boolean.FALSE</defaultvalue>
    <persistence type="property"/>
    <modifiers read="true" write="true" search="true" optional="false"/>
    ...
Use an attribute persistence type of dynamic, instead of Jalo.
JALO is a deprecated API and its use isn't recommended. Previously, JALO attributes were used when you needed some business logic to be executed before returning a result. This behavior can now be achieved with Dynamic Attributes in the Service Layer without needing to touch JALO:
<itemtype code="MyProduct" extends="Product" autocreate="true" generate="true">
<attributes>
     <attribute qualifier="myAttribute" type="java.lang.String">
          <persistence type="jalo"/>  <!-- should only use property or dynamic -->
     </attribute>
  </attributes>
</itemtype>
Start Item type Names (including EnumTypes and Relations) with an uppercase letter.
For consistency, start all type names with an uppercase letter. You can run into issues with the code generators if you don't follow this convention. The following displays an example:
<itemtype code="myProduct" extends="Product" autocreate="true" generate="true">
<!-- violation here "myProduct" should be "MyProduct" -->
    <attributes{{> }}
    ...
    </attributes>
</itemtype>
Do not start Item type names with Generated.
Starting a type name with the string "Generated" can have some side effects because an abstract class that starts with "Generated" is created by SAP Commerce Cloud already. The following displays a noncompliant example:
<itemtype code="GeneratedProduct" extends="Product" autocreate="true" generate="true">  
<!-- violation here "GeneratedProduct" will cause some side effects -->
    <attributes{{> }}
    ...
    </attributes>
</itemtype>
Start item type attribute names with a lowercase letter.
Values of the qualifier attribute of an item type's attribute tag should start with a lower case letter. If you do not follow this convention, some code generators that assume it can cause problems. The following displays a compliant example:
<attribute autocreate="true" qualifier="global" type="java.lang.Boolean" generate="true">
    <defaultvalue>Boolean.FALSE</defaultvalue>
    <persistence type="property"/>
    <modifiers read="true" write="true" search="true" optional="false"/>
    ...
Start qualifier names in relations with a lowercase letter.
Values of the qualifier attribute of a relation's sourceElement and targetElement tags should start with a lower case letter. If you do not follow this convention, some code generators that assume it can cause problems. The following displays a compliant example:
<relation code="CatalogsForBaseStores" generate="true"
    localized="false" autocreate="true">
    <deployment table="Catalogs4BaseStores" typecode="2012" />
    <sourceElement qualifier="baseStores" type="BaseStore" cardinality="many" />
    <targetElement qualifier="catalogs" type="Catalog" cardinality="many" collectiontype="list" ordered="true" />
</relation>
Avoid setting ordered='true' on any side of a relation that has cardinality='many' unless absolutely necessary.
Order="true" has a significant impact on performance when reading and writing from the database. The queries required to provide a defined order to the items that are returned are much more complex and expensive that an unordered query. Using ordered="true" should only be used when absolutely necessary. The following displays a noncompliant example:
<relation code="CatalogsForBaseStores" generate="true"
    localized="false" autocreate="true">
...
    <targetElement qualifier="catalogs" type="Catalog"
cardinality="many" collectiontype="list" ordered="true" />
</relation>
The following displays a compliant example:
<relation code="CatalogsForBaseStores" generate="true"
    localized="false" autocreate="true">
...
    <targetElement qualifier="catalogs" type="Catalog"
cardinality="many" collectiontype="list" />
</relation>
Use collectiontype='set' on any side of a relation that has cardinality='many' where items must not appear in that relation multiple times.
The set guarantees that every relation is persisted only once. For example, if a Product is related to a Category, it's desirable to store this relation as one row only in the database. The following displays a noncompliant example:
<relation code="CatalogsForBaseStores" generate="true"
    localized="false" autocreate="true">
...
    <targetElement qualifier="catalogs" type="Catalog"
cardinality="many" collectiontype="list" />
</relation>
The following displays a compliant example:
<relation code="HistoryDocumentRelation" autocreate="true"
    generate="false" localized="false">
    ...
    <targetElement type="Media" qualifier="documents"
collectiontype="set" cardinality="many" ordered="false">
    ...
    </targetElement>
</relation>
Mark CatalogVersion attributes as unique for Catalog aware types.
The CatalogVersion attribute forms part of the unique key for Catalog Synchronization. To ensure that the same uniqueness rules are applied for other processes (for example, ImpEx), you need to set the CatalogVersion attribute to unique="true". The following displays a noncompliant example:
<itemtype code="MyCatalogType" extends="GenericItem" autocreate="true" generate="true">
             <deployment table="MyCatalogType" typecode="XXXX"/>
             <custom-properties>
                 <property name="catalogItemType">
                     <value>java.lang.Boolean.TRUE</value>
                 </property>
                 <property name="catalogVersionAttributeQualifier">
                     <value>"catalogVersion"</value>
                 </property>
                 <property name="uniqueKeyAttributeQualifier">
                     <value>"uid"</value>
                 </property>
             </custom-properties>
             <attributes>
                 <attribute qualifier="uid" generate="true" autocreate="true" type="java.lang.String">
                     <persistence type="property"/>
                     <modifiers optional="false" unique="true"/>
                 </attribute>
                 <attribute qualifier="catalogVersion" type="CatalogVersion">
                     <modifiers optional="false"/>  <!-- violation here because missing unique="true" -->
                     <persistence type="property"/>
                 </attribute>
             </attributes>
         </itemtype>
Ensure unique attributes match the catalog unique attribute key, uniqueKeyAttributeQualifier.
The attributes defined as unique for the type should be the same attributes as those defined in the custom property, uniqueKeyAttributeQualifier. The uniqueKeyAttributeQualifier custom property defines the unique attributes for Catalog Synchronization whereas processes using the Service Layer (including the Catalog Synchronization persistence) use the unique attributes on the type. The following displays a noncompliant example:
<itemtype code="MyCatalogType" extends="GenericItem"
             autocreate="true" generate="true">
             <deployment table="MyCatalogType" typecode="XXXX"/>
             <custom-properties>
                 <property name="catalogItemType">
                     <value>java.lang.Boolean.TRUE</value>
                 </property>
                 <property name="catalogVersionAttributeQualifier">
                     <value>"catalogVersion"</value>
                 </property>
                 <property name="uniqueKeyAttributeQualifier">
                     <value>"uid"</value>
                 </property>
             </custom-properties>
             <attributes>
                 <attribute qualifier="uid" generate="true" autocreate="true" type="java.lang.String">
                     <persistence type="property"/>
                     <modifiers optional="false" unique="false"/>  <!-- violation here because missing unique="true" -->
                 </attribute>
                 <attribute qualifier="catalogVersion" type="CatalogVersion">
                     <modifiers optional="false" unique="true"/>
                     <persistence type="property"/>
                 </attribute>
             </attributes>
         </itemtype>
Define database indexes for the unique attributes of type.
There should be a covering index defined that includes all the unique attributes for type. There are Service Layer interceptors that validate uniqueness for each type, which generates a query for all the unique attributes. Failure to add an index can cause serious performance issues. Furthermore, the validation of the unique attributes in the Service Layer can't guarantee that there won't be duplicate records in the database, only a unique index/constraint can do this. The following displays a noncompliant example:
	<itemtype code="MyType" extends="GenericItem">
			<deployment table="MyType" typecode="XXXXX"/>
			<attributes>
				<attribute qualifier="uid" type="java.lang.String">
					<persistence type="property"/>
					<modifiers optional="false" unique="true"/>
				</attribute>
				<attribute qualifier="name" type="java.lang.String">
					<persistence type="property"/>
				</attribute>
			</attributes>

			<indexes>
				<index name="nameIDX">
					<key attribute="name"/>
				</index>
				<!-- Non-compliant - there is no index covering the {uid} unique attribute-->
			</indexes>
		</itemtype>
See an example of a compliant solution:
		<itemtype code="MyType" extends="GenericItem">
			<deployment table="MyType" typecode="XXXXX"/>
			<attributes>
				<attribute qualifier="uid" type="java.lang.String">
					<persistence type="property"/>
					<modifiers optional="false" unique="true"/>
				</attribute>
				<attribute qualifier="name" type="java.lang.String">
					<persistence type="property"/>
				</attribute>
			</attributes>

			<indexes>
				<index name="nameIDX">
					<key attribute="name"/>
				</index>
				<!-- Compliant - there is an index covering the {uid} unique attribute. The index can be marked as unique to guarantee the uniqueness on DB level -->
				<index name="uidIDX" unique="true/false">
					<key attribute="uid"/>
				</index>
			</indexes>
		</itemtype>
You can disable interceptors that check for uniqueness when there's a correct unique index defined that includes all unique attributes for a given type using the following property:
unique.attribute.interceptor.db.index.enabled=true

The default value of this property is false.

Ensure catalog aware types aren't part of a one-to-many relation when the many side isn't a catalog aware type.
Creating a one-to-many relation where the one side of the relation is a Catalog aware type and the many side isn't a Catalog aware type causes an issue when synchronizing. The reference to the Catalog aware type is transferred from the Staged to the Online version. The Staged version no longer has a reference. The following shows a noncompliant example:
<relation code="Product2Author" generate="true" localized="false" autocreate="true">
             <sourceElement type="Product" cardinality="one" qualifier="product"/>  <!-- violation here, MyItem is not a catalog aware type and it can only reference a single Product (not a Staged and Online version -->
             <targetElement type="MyItem" cardinality="many" qualifier="myItems" ordered="true"/> 
</relation>
Ensure all types have unique attributes.
Every type should have one or more unique identifiers defined or should inherit the unique attributes from a super type. This allows the data to be easily imported or exported into different systems and prevents duplicate entries in the database. The following displays a noncompliant example:
<itemtype code="MyType" extends="GenericItem" autocreate="true" generate="true">
             <deployment table="MyType" typecode="XXXX"/>
             <attributes>  <!-- missing a unique attribute -->
                 <attribute qualifier="name" generate="true" autocreate="true" type="java.lang.String">
                     <persistence type="property"/>
                     <modifiers optional="false" unique="false"/>
                 </attribute>
             </attributes>
  </itemtype>
Do not use unoptimized attributes.
Using dontOptimize="true" stores the data for this type in a secondary table defined by the "propertytable" attribute of the deployment or the props table if no propertytable is defined. Generally, it isn't recommended to store attribute values in this way because it's more expensive to store and retrieve the values because joins are required. The following displays a noncompliant example:
<itemtype code="MyType" extends="GenericItem" autocreate="true" generate="true">
             <deployment table="MyType" typecode="XXXX" propertytable="MyTypeProps"/>
             <attributes>
                 <attribute qualifier="name" generate="true" autocreate="true" type="java.lang.String">
                     <persistence type="property"/>
                     <modifiers optional="false" unique="false" dontOptimize="true"/>
<!-- defining dontOptimize stores this value in the property table for this
type (MyTypeProps) of the props table if none is defined -->
                 </attribute>
             </attributes>
  </itemtype>
Choose whether to add to an existing item type or create a new subtype carefully.
When extending an existing type to add new attributes, you can either add the attributes or create a new subtype to the existing type. The following displays an example of adding new attributes to an existing type:
<itemtype code="Product" autocreate="false" generate="false">
<attributes>
      <attribute qualifier="newAttribute" type="java.lang.String">
      <modifiers read="true" write="true" search="true" optional="true"/>
       <persistence type="property"/>
</attribute>
</itemtype>
The following displays an example of creating a new subtype:
<itemtype code="MyProduct" extends="Product" autocreate="true" generate="true">
<attributes>
      <attribute qualifier="newAttribute" type="java.lang.String">
      <modifiers read="true" write="true" search="true" optional="true"/>
      <persistence type="property"/>
</attribute>
</itemtype>
Whether to subtype or extend the existing type should be based on the following decisions:
  • If: Adding an attribute for all instances

    Then: Add to existing type

    Because:

    If all instances of the existing type could have a value for this data, then the attribute belongs on existing type. Creating an unnecessary subtype can create issues because a business user could create an instance of the super type that doesn't have all the required/expected attributes. For example, a user could create instances of items that aren't compatible with the business logic.

    For example, if you subtype Category and create new type with a mandatory attribute called "enabledForFrontend". Business users can still create a standard Category item that doesn't have the required attribute that the front end is expecting.

    In addition, the SAP Commerce Cloud APIs expect the existing type so the project code is cluttered by "if instance of then (cast)" constructs when a subtype is used.

  • If: Adding an attribute for specific instances

    Then: Create a new subtype

    Because: If only some instances have data for a particular attribute then you should subtype.

  • If: Redeclaring an existing attribute, for example changing mandatory to optional

    Then: Create a new subtype

    Because: Redeclaring requires subtyping

    Redeclare only when necessary because it can cause potential issues if business users are still able to use the existing types that don't have the attributes required by the system. If subtyping is required, then consider redeclaring attributes so that the new subtypes are returned instead of the existing types.

    Although it's typical for implementations to extend an SAP Commerce Cloud type by subclassing, it's preferable to override the type and embed the new fields into it. For example, if a customer wants to add new fields to the Category model, the standard approach used in implementations is to subclass it. If there are any other direct subclasses, or the new fields are shared by other subclasses, it's preferable to simply add the new fields directly to the Category model. This results in a simplification of the data model and queries against the data model.

    Finally, rather than extending or subclassing a type, it can be preferable use a composition approach in which you create new types with relations to the core SAP Commerce Cloud types.

Describe the purpose and intended use of an attribute in a description tag.
The attribute name doesn't always indicate clearly and completely the purpose and intended use of an attribute. Provide this extra information within the XML file by including a description tag with each attribute. The following displays an example:
<attribute type="java.lang.Integer" qualifier="cartRemovalAge">
    <modifiers />
    <persistence type="property" />
    ...                    
    <description>After specified number of seconds carts will be cleaned up. Default is 28 days.</description></attribute>
Remove unnecessary indexes.

Index management is cost intensive. As a rule of thumb, indexes should only be added for attributes used in flexible searches.

In addition, when designing indexes, take into account the characteristics of the specific databases being used.

SAP Commerce Cloud creates a significant number of database indexes that an implementation project might never use. Database indexes slow down the writing to the database so remove indexes that aren't in use to improve large impex import performance. Microsoft SQL Server, Oracle, and MySQL have ways for identifying unused indexes.

Localize any attributes that need to be displayed in a different language.
Add the localized keyword to attribute definitions where the value varies according to language. The following shows an example:
<attribute qualifier="name" type="localized:java.lang.String">
    ...
</attribute>
Avoid using collections and use relations instead.
In general, the use of relations is preferable to the use of collection types. Collection types can be subject to truncation issues so unless you have good reasons to use one, use a relation instead. The following shows a noncompliant example:
<collectiontype code="AbstractOrderEntryCollection" elementtype="AbstractOrderEntry" autocreate="true" generate="false" type="list"/>
                        ...
<itemtype code="AbstractOrder"
          jaloclass="de.hybris.platform.jalo.order.AbstractOrder"
          autocreate="true"
          generate="true">
    ...
    <attributes>
        <attribute autocreate="true" qualifier="entries" type="AbstractOrderEntryCollection"/>
        ...
    </attributes>
 </itemtype>
The following displays a compliant example:
<relation code="AbstractOrder2AbstractOrderEntry" localized="false" generate="true" autocreate="true">
    <sourceElement type="AbstractOrder" qualifier="order" cardinality="one">
    ...
    </sourceElement>
    <targetElement type="AbstractOrderEntry" qualifier="entries" cardinality="many" collectiontype="list"
      ordered="false">
    ...
    </targetElement>
</relation>
Define types in order of inheritance.
More abstract types need to be defined more to the beginning of the items.xml file and more concrete types need to be defined more to the end. The following displays a noncompliant example:
<itemtype code="User" extends="Principal"
    jaloclass="de.hybris.platform.jalo.user.User"
    autocreate="true"
    generate="true">
    ...
</itemtype>
...
<itemtype code="Principal" <!-- violation: User should be defined after Principal -->
    extends="GenericItem"
    jaloclass="de.hybris.platform.jalo.security.Principal"
    autocreate="true"
    abstract="true"
    generate="true">
    ...
</itemtype>
...
<itemtype code="Customer" extends="User"
    jaloclass="de.hybris.platform.jalo.user.Customer"
    autocreate="true"
    generate="true">
...
 </itemtype>
The following displays a compliant example:
<itemtype code="Principal"
    extends="GenericItem"
    jaloclass="de.hybris.platform.jalo.security.Principal"
    autocreate="true"
    abstract="true"
    generate="true">
    ...
</itemtype>
...
<itemtype code="User" extends="Principal"
    jaloclass="de.hybris.platform.jalo.user.User"
    autocreate="true"
    generate="true">
    ...
</itemtype>
...
<itemtype code="Customer" extends="User"
    jaloclass="de.hybris.platform.jalo.user.Customer"
    autocreate="true"
    generate="true">
...
 </itemtype>
Type names must be unique.
Before defining any new item type, make sure that there's no type with the same name in any other extension. The build system complains if you try to create two types with the same name, and implementors are unable to use both extensions in the same project. The following displays a noncompliant example:
core-items.xml
 
<itemtype code="Order"
          extends="AbstractOrder"
          jaloclass="de.hybris.platform.jalo.order.Order"
          autocreate="true"
            generate="true">
    ...
</itemtype>
 
basecommerce-items.xml:
 
<itemtype code="Order" autocreate="true" generate="true">
<!-- violation: autocreate and generate set to true means you are trying to define a new type with the same name as one already defined in core-items.xml -->
    <attributes>
        <attribute qualifier="versionID" type="java.lang.String">
        ...
Do not change attribute definitions unless absolutely necessary.
To easily upgrade from one version to another, do not change attribute definitions. The modification of an attribute qualifier has serious consequences on a system update. A change of upper/lower case spelling causes API incompatibilities because the signature of generated getters/setters changes. A change of spelling is same as removing the attribute from items.xml and defining a new one with different name. With that the data is stored in a new column, the old data isn't accessible anymore by generated API. There's no automated way to fix this problem.
If a type change isn't supported by the type of database being used, the modification of an attribute type doesn't alter the database schema. Nevertheless, the generated API changes, resulting in incompatibilities and a high probability of exceptions at runtime. The modification of attribute type in redeclaration mode (for example, MyProduct.code needs to be changed from String to Long) throws a build error in the case of incompatible type hierarchy.
Modification of columntype (subtag of persistence type) succeeds if the type is compatible on database level, otherwise there's no effect.
The modification of attribute modifiers is ok partly. The read and write flag influences code generation and with this can cause API incompatibilities. All other modifier modifications cause different behavior that can be serious and must be checked in detail. For example: adding a unique flag can cause inconsistent data.
Do not change deployment code or table names unless absolutely necessary.
The typecode specified in a deployment tag forms part of the PK of the items inside the database. It helps find items quickly by their PK because the typecode points directly to the correct database table. When you change a typecode for a table, all old items inside the table are no longer found and are lost with it.
If you change the table name, you get a new table, and you lose access to the old data .
Do not change a type declaration unless absolutely necessary.
In general, modifying the values of an existing itemtype tag results in API incompatibilities between the two versions. This breaks backwards compatibility and makes upgrades harder.
Define a database index on the lookup value of reference types.
To improve the performance of large impex imports, Unit.code and Genders.code should both have database indexes if there are a significant number of rows (more than 100). See the following example:
INSERT_UPDATE ApparelProduct;code[unique=true];unit(code);type(code)
;300441142;;pieces;8,46 GBP, 9,70 EUR, 13,11 USD;Blue Tomato,caps;;;;1022436212;Fruit