cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when looking for parent Integration Object Item in OData Service in SAP CX 1905.0

0 Kudos

We have found something that looks like an issue in Hybris version 1905.0

When you try to define an Integration Object that tries to build the response for an object that has several parent definitions, an error is raised that looks like this one

The Integration Object and the ItemModel class provided have more than one match, please adjust the Integration Object definition of Item

We have checked that the code to retrieve the IntegrationObjectItems in class de.hybris.platform.integrationservices.service.impl.DefaultIntegrationObjectService is different between version 1811.x and 1905.0. In version 1905.0 there is a new fallback method to retrieve the integration object through the parent type, that is done by this method

de.hybris.platform.integrationservices.service.IntegrationObjectService#findIntegrationObjectItemByParentTypeCode that executes the following query

 final String queryString =
                 "SELECT DISTINCT {inteObjItem." + IntegrationObjectItemModel.PK + "}"
                         + " FROM {" + IntegrationObjectItemModel._TYPECODE + " as inteObjItem"
                         + " JOIN " + IntegrationObjectModel._TYPECODE + " as inteObj"
                         + " ON {inteObjItem:" + IntegrationObjectItemModel.INTEGRATIONOBJECT + "} = {inteObj:" + IntegrationObjectModel.PK + "}"
                         + " JOIN " + ComposedTypeModel._TYPECODE + " as ct"
                         + " ON {inteObjItem:" + IntegrationObjectItemModel.TYPE + "} = {ct:" + ComposedTypeModel.PK + "}}"
                         + " WHERE {inteObj." + IntegrationObjectModel.CODE + "}=?integrationObjectCode AND {ct." + ComposedTypeModel.PK + "} IN (?pks)";


Being the possible pks all the super types of the item

 itemType.getAllSuperTypes();

With this modification this kind of definition of an Integration Object:

 INSERT_UPDATE IntegrationObject; code[unique = true]
                                ; InboundProduct
 
 INSERT_UPDATE IntegrationObjectItem; integrationObject(code)[unique = true]; code[unique = true]; type(code)
                                    ; InboundProduct                        ; Product            ; Product
                                    ; InboundProduct                        ; Catalog            ; Catalog
                                    ; InboundProduct                        ; CatalogVersion     ; CatalogVersion
                                    ; InboundProduct                        ; VariantProduct     ; VariantProduct
 
 
 INSERT_UPDATE IntegrationObjectItemAttribute; integrationObjectItem(integrationObject(code), code)[unique = true]; attributeName[unique = true]; attributeDescriptor(enclosingType(code), qualifier); returnIntegrationObjectItem(integrationObject(code), code); unique[default = false]; autoCreate[default = false]
                                             ; InboundProduct:VariantProduct                                      ; catalogVersion              ; VariantProduct:catalogVersion                      ; InboundProduct:CatalogVersion                             ; true                   ;
                                             ; InboundProduct:VariantProduct                                      ; code                        ; VariantProduct:code                                ;                                                           ; true                   ;
                                             ; InboundProduct:Catalog                                             ; id                          ; Catalog:id                                         ;
                                             ; InboundProduct:CatalogVersion                                      ; catalog                     ; CatalogVersion:catalog                             ; InboundProduct:Catalog
                                             ; InboundProduct:CatalogVersion                                      ; version                     ; CatalogVersion:version                             ;
                                             ; InboundProduct:CatalogVersion                                      ; active                      ; CatalogVersion:active                              ;
                                             ; InboundProduct:Product                                             ; variants                    ; Product:variants                                   ; InboundProduct:VariantProduct                             ;                        ;
 

and calling the endpoint with GET https://localhost:9002/odata2webservices/InboundProduct/Products is failing due to the existence of variant attribute, while in version 1811.x was not failing, although was not filling correctly the response when trying to make a query like this:

GET https://localhost:9002/odata2webservices/InboundProduct/Products('Online%7CdemoProductCatalog%7C1111...

Is this the expected behaviour from SAP CX side? Or there is indeed an issue when trying to retrieve the data via the parent type?

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

We have make a slight modification in our modeling to have the impexes in this way:

 INSERT_UPDATE IntegrationObject; code[unique = true]
                                ; InboundProduct
 
 INSERT_UPDATE IntegrationObjectItem; integrationObject(code)[unique = true]; code[unique = true]   ; type(code)
                                    ; InboundProduct                        ; Product               ; Product
                                    ; InboundProduct                        ; Catalog               ; Catalog
                                    ; InboundProduct                        ; CatalogVersion        ; CatalogVersion
                                    ; InboundProduct                        ; GenericVariantProduct ; GenericVariantProduct
 
 
 INSERT_UPDATE IntegrationObjectItemAttribute; integrationObjectItem(integrationObject(code), code)[unique = true]; attributeName[unique = true]; attributeDescriptor(enclosingType(code), qualifier); returnIntegrationObjectItem(integrationObject(code), code); unique[default = false]; autoCreate[default = false]
                                             ; InboundProduct:GenericVariantProduct                               ; catalogVersion              ; GenericVariantProduct:catalogVersion               ; InboundProduct:CatalogVersion                             ; true                   ;
                                             ; InboundProduct:GenericVariantProduct                               ; code                        ; GenericVariantProduct:code                         ;                                                           ; true                   ;
                                             ; InboundProduct:Catalog                                             ; id                          ; Catalog:id                                         ;
                                             ; InboundProduct:CatalogVersion                                      ; catalog                     ; CatalogVersion:catalog                             ; InboundProduct:Catalog
                                             ; InboundProduct:CatalogVersion                                      ; version                     ; CatalogVersion:version                             ;
                                             ; InboundProduct:CatalogVersion                                      ; active                      ; CatalogVersion:active                              ;
                                             ; InboundProduct:Product                                             ; variants                    ; Product:variants                                   ; InboundProduct:GenericVariantProduct                      ;                        ;
 

We can do this because we know that every VariantProduct that we can have is a GenericVariantProduct, but still, we think this is an issue for other projects that could have as variants different types of variants, like with the Apparel modeling of data.