In SAP Hybris Commerce 6.x, the default database column length for an Itemtype Attribute String type is 255 characters. A client recently asked to increase the database column length for the Orders table P_NAME column from the default 255 variable characters length to 500 variable characters length. In this tutorial, I will show you how to properly increase the database column in SAP Hybris Commerce. For this tutorial, I'm using the default Hybris database, HSQLDB.
- Open the <Your Hybris DIR>/ext/core/resources/core-items.xmll file using your preferred text file editor.
- Once the core-items.xml file is open, find the attribute qualifier="name" under AbstractOrder itemtype node. For example:
- Make the following modification to the persistence node:
<persistence type="property"> <columntype database="hsqldb> <value>varchar(500)</value> </columntype> </persistence>
The modification should resemble the following:
*This modification only supports hsqldb, to support MySQL replace hsqldb with mysql
- Next run Hybris Initialization using the hybris administrative console (HAC), if you are performing this tutorial on your local machine goto https://localhost:9002/
- Login to the HAC using your admin credentials.
- Goto Platform -> Initialization in the main menu
- Click on the Initialize button, and keep the Toggle all checkbox selected
*Note, by performing a Hybris Initialization, your database schema and data will be updated, existing data will be lost.
- Several minutes later, the Hybris Initialization will be completed, click on the Continue link to complete the Initialization.
- The Orders table P_NAME column is now 600 variable characters. The tutorial is complete.