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

PromotionPriceRow Error - invalid character value for cast

Former Member
0 Kudos
648

Hybris 5.7.0.3

I have created a new promotion type. When I attempt to create a new promotion, I get the following error when I click to "Create promotion price row". I am not sure what I am missing. Any ideas?

de.hybris.platform.servicelayer.exceptions.ModelSavingException: org.springframework.dao.DataIntegrityViolationException: query; SQL []; data exception: invalid character value for cast; nested exception is java.sql.SQLDataException: data exception: invalid character value for cast

 <itemtype code="OrderDiscountOnDeliveryMethodPromotion"
             extends="OrderPromotion"
             jaloclass="com.remington.promotions.jalo.OrderDiscountOnDeliveryMethodPromotion"
             autocreate="true" generate="true">
             <description>Fixed Discount Delivery</description>
             <!-- Attribute to hold discount -->
             <attributes>
             
                 <attribute
                     qualifier="fixedDiscount"
                     autocreate="true"
                     type="PromotionPriceRowCollectionType">
                     <description>The cart total value threshold in specific currencies.</description>
                     <persistence type="property" />
                     <modifiers read="true" write="true" search="false" initial="false" optional="true" partof="true" />
                 </attribute>
                 
                 <attribute
                     qualifier="thresholdTotals"
                     autocreate="true"
                     type="PromotionPriceRowCollectionType">
                     <description>The cart total value threshold in specific currencies.</description>
                     <persistence type="property" />
                     <modifiers read="true" write="true" search="false" initial="false" optional="true" partof="true" />
                 </attribute>
View Entire Topic
former_member190306
Participant
0 Kudos

Hi,

I'm not sure what causes your problem, the extended stack trace might be interessting in this case. Maybe you changed the type system without re-initialize or update the system, and now the generated business logic does not fit to the type system/database anymore?!

Nevertheless I see a problematic scenario: you are using collection type attributes to persist data. This is not recommended by hybris (see the related comment on https://help.hybris.com/6.0.0/hcd/8c755da8866910149c27ec908fc577ef.html saying "Use RelationTypes whenever possible")

So, I recommend to first adapt your data model and then see if the error still exists

Former Member
0 Kudos

PromotionPriceRowCollectionType is a collection type defined in OOTB promotions-items.xml and is used extensively. I have updated the system via the HAC. I have attached the stack trace

former_member190306
Participant
0 Kudos

Do you have any logic that is modifying the model values? E.g. Interceptors or DynamicAttributeHandlers?

Seems like this issue is caused by some SQL query values that do not fit the database schema.

See e.g. http://howtodoinjava.com/jpa/solved-hsqlexception-data-exception-invalid-character-value-for-cast/ or http://stackoverflow.com/questions/18842454/org-hsqldb-hsqlexception-data-exception-invalid-characte...

Former Member
0 Kudos

The thing is, everything is generated:

GeneratedOrderDiscountOnDeliveryMethodPromotion.java GeneratedTypeInitializer.java OrderDiscountOnDeliveryMethodPromotionDTO.java OrderDiscountOnDeliveryMethodPromotionModel.java

So, I am not sure where the cast exception is occurring.