在 Hybris 中加入购物车条目和产品 Table

Joining Cart entry and Product Table in Hybris

我不熟悉 hybris 中的灵活搜索查询 我需要删除具有特定产品 ID 的购物车条目 - 我正在使用以下查询来获取条目

SELECT {products.PK} FROM {Product AS products JOIN CartEntry  AS carts ON {products.PK} = {CartEntry.PRODUCT} } Where {products.PK} ='<PK of the product>'

我一直收到以下异常 message.Is 我遗漏了什么

Exception message: cannot find (visible) type for alias CartEntry within [carts:CartEntry, products:Product]

尝试使用以下查询:

SELECT {products.PK} FROM {Product AS products JOIN CartEntry  AS carts ON {products.PK} = {carts.product} } Where {products.PK} ='<PK of the product>'

希望对您有所帮助

问题是您混合了项目类型的别名和实际名称,即 {products.PK} = {CartEntry.PRODUCT},其中 products 是别名,而 CartEntry 是项目类型的实际名称。以下将起作用:

SELECT {products.PK} FROM {Product AS products JOIN CartEntry  AS carts ON {products.PK} = {carts.product} } WHERE {products.PK} ='<PK of the product>'

您还可以使用以下任意一项:

SELECT {Product.PK} FROM {Product JOIN CartEntry ON {Product.PK} = {CartEntry.product} } WHERE {Product.PK} ='<PK of the product>'

SELECT {PK} FROM {Product}, {CartEntry}  WHERE {Product.PK} = {CartEntry.product} AND {Product.PK} ='<PK of the product>'

SELECT {PK} FROM {Product AS products}, {CartEntry AS carts}  WHERE {products.PK} = {carts.product} AND {products.PK} ='<PK of the product>'

SELECT {products.PK} FROM {Product AS products}, {CartEntry AS carts}  WHERE {products.PK} = {carts.product} AND {products.PK} ='<PK of the product>'