on 2017 Jan 12 4:56 PM
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>
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.