Skip to content

[Impex] &ref not working when updated in between #35

@bnussbau

Description

@bnussbau
 <type name="Product" package="at.benjaminnussbaum.spotbudget.types.itemtypes.product">
        <properties>
            <property name="brand" type="String">
                <description></description>
            </property>
            <property name="name" type="String">
                <description></description>
            </property>
            <property name="fullName" type="String">
                <description></description>
            </property>
            <property name="productDescription" type="String">
                <description></description>
            </property>
            <property name="receiptText" type="String">
                <description></description>
            </property>
            <property name="category" type="String">
                <description></description>
            </property>
            <property name="pictureUrl" type="String">
                <description></description>
            </property>
            <property name="sparProductCode" type="String">
                <description></description>
            </property>
        </properties>
    </type>
<type name="Ean13Product" package="at.benjaminnussbaum.spotbudget.types.itemtypes.product" extends="EanProduct">
        <properties>
            <property name="ean13code" type="String" unique="true">
                <description>EAN / EAN-13 barcode</description>
            </property>
            <property name="variableEan" type="Boolean" default="false">
                <description></description>
            </property>
            <property name="variableEanDigits" type="Integer">
                <description></description>
            </property>
        </properties>
    </type>
<type name="PriceRow" package="at.benjaminnussbaum.spotbudget.types.itemtypes.product.price">
        <properties>
            <property name="amount" type="Double">
                <description></description>
            </property>
            <property name="date" type="LocalDateTime">
                <description>Tansaction date</description>
            </property>
            <property name="currency" type="Currency">
                <description>Transaction amount</description>
            </property>
            <property name="provider" type="PriceProviderType">
                <description></description>
            </property>
        </properties>
    </type>

    <relation name="Product2PriceRow">
        <source itemType="Product" mappedBy="product" cardinality="one">
            <description></description>
        </source>
        <target itemType="PriceRow" mappedBy="priceRows" cardinality="many">
            <description></description>
        </target>
    </relation>
INSERT_UPDATE Ean13Product; ean13code[unique = true]; receiptText                ; &ref
                          ; 9100000709444           ; SBUDGET KUECHENROLLE       ; 9100000709444

UPDATE Ean13Product; ean13code[unique = true]; receiptText           ; sparProductCode;
                   ; 9100000709444           ; SBUDGET KUECHENROLLE  ; 2020000926726

INSERT_UPDATE PriceRow; product(&ref)        ; amount;
                      ; 9100000709444       ; 2.19  ;
Caused by: org.springframework.transaction.TransactionUsageException: Error during transactional execution.; nested exception is io.spotnext.core.infrastructure.exception.ImpexImportException: Could not import item of type at.benjaminnussbaum.spotbudget.types.itemtypes.product.price.PriceRow (Found more than 1 result for the given search parameters). Line that caused this error: , 9100000709444, 2.19, 
	at io.spotnext.core.persistence.service.impl.DefaultTransactionService.execute(DefaultTransactionService.java:94)
	at io.spotnext.core.persistence.service.impl.DefaultTransactionService.executeWithoutResult(DefaultTransactionService.java:110)
	at io.spotnext.core.infrastructure.strategy.impl.DefaultImpexImportStrategy.importImpex(DefaultImpexImportStrategy.java:129)
	at io.spotnext.core.infrastructure.service.impl.DefaultImportService.importItems(DefaultImportService.java:39)
	at io.spotnext.core.infrastructure.support.init.ModuleInit.importScript(ModuleInit.java:177)
	at at.benjaminnussbaum.spotbudget.Init.importSampleData(Init.java:29)

Without the UPDATE line, it works.
Is that something that should be considered?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions