cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

What should be the type of attribute to hold long String value?

former_member686625
Participant
0 Kudos
6,403

Hi,

I have created an attribute in a component type which is extending SimpleCMSComponent. As it can contain very large data i defined it as below:

 en<attribute qualifier="description" type="localized:java.lang.String">
                         <description>Description of purchase policy topic</description>
                         <modifiers read="true" write="true" search="true"
                         optional="true" />
                         <persistence type="property">
                             <columntype database="oracle">
                                 <value>CLOB</value>
                             </columntype>
                             <columntype database="sap">
                                 <value>NCLOB</value>
                             </columntype>
                             <columntype>
                                 <value>HYBRIS.LONG_STRING</value>
                             </columntype>
                         </persistence>
                     </attribute>

In local I am using HSQL and in environment it will be SAP HANA. Similarly, I did this for another attribute "shortDescription" in item type Product.

Issue is that, the large content is getting save in attribute shortDescription of Product but it is given error when I am trying to save it in Component's attribute. Please let me know what am I doing wrong.

Error is:

 INFO   | jvm 1    | main    | 2018/06/13 12:10:57.211 | Caused by: de.hybris.platform.servicelayer.exceptions.ModelSavingException: sql error saving EJBPropertyRowCache[itemPK:null,langPK:8796093055008,inDB:true,hasChanged:true,names:[description, title],values:[<p>We know this isn't the most interesting page of the Site, but these terms and policies are important and affect your legal rights.                                      <span>PLEASE READ CAREFULLY.</span>                                 </p>                                 <p>The Terms of Use and Purchase Policy make up a legal Agreement between you (you or your) and Edgewell Personal Care Company and/or its affiliates (Edgewell, we, our, or us).</p>, Terms of use],changeList:{0}]:2053908843 for item 8796160525372 , query = UPDATE cmscomponentlp SET p_description = ? ,ITEMTYPEPK = ? WHERE ITEMPK = ?  AND LANGPK = ?  values = [<p>We know this isn't the most interesting page of the Site, but these terms and policies are important and affect your legal rights.                                      <span>PLEASE READ CAREFULLY.</span>                                 </p>                                 <p>The Terms of Use and Purchase Policy make up a legal Agreement between you (you or your) and Edgewell Personal Care Company and/or its affiliates (Edgewell, we, our, or us).</p>, 8796140666962, 8796160525372, 8796093055008]java.sql.SQLDataException: data exception: string data, right truncation


Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

agrabovskis
Participant
0 Kudos

Please take into account that "system update" does not check/alter column length limits and does not convert between different text-type columns (e.g. no conversion from varchar(255) to text) - you have to do that directly in the database.

former_member686625
Participant
0 Kudos

Hi Arvids,

Thanks for the reply. Can you please tell me if initially I have defined attribute with type as "localized:java.lang.String" and "". Later on if I want to give column length like:

 <columntype database="sap">
     <value>nvarchar(4000)</value>
 </columntype>
 <columntype>
         <value>HYBRIS.LONG_STRING</value>
 </columntype>


and do system update then will it take size into account for same attribute?

Thanks Manish

agrabovskis
Participant
0 Kudos

No. Size won't be adjusted. You have to modify the column type directly in the database (that also gives you flexibility of changing column length runtime without the risk of next system update overwriting the changes).

former_member686625
Participant
0 Kudos

Thanks Arvids.

As I don't have access to the db used in environment, I choose to use new attribute with required size. 🙂

Thanks again,

former_member686625
Participant
0 Kudos

Hi,

It is still not fixed 😞
In SAP HANA DB, I am getting value is too long for attribute. With same db configuration given in -items.xml one attribute is accepting the long value but attribute in component is giving error.

Any help.

Thanks

former_member686625
Participant
0 Kudos

It got fixed after initialization. Earlier I created attribute as String type only that is why new changes were not reflecting. If initialization is not possible then create new attribute.

Thanks.