gpt4 book ai didi

mysql - 灵活搜索错误 : missing values

转载 作者:可可西里 更新时间:2023-11-01 08:28:44 29 4
gpt4 key购买 nike

Hybris 控制台:

ERROR [hybrisHTTP19] [FlexibleSearch] Flexiblesearch error: missing values for [emailId, productCode], got {13=8796135981138, issent=false, productcode =0100, emailid ='hybrisa@gmail.com'}
ERROR [hybrisHTTP19] [FlexibleSearch] query was 'SELECT {p:pk} FROM {NotifyStock AS p} WHERE {p:status}=?isSent AND {p:productId}=?productCode AND {p:emailId}=?emailId '
ERROR [hybrisHTTP19] [FlexibleSearch] translated query was: SELECT item_t0.PK FROM notifystock item_t0 WHERE ( item_t0.p_status =? AND item_t0.p_productid =? AND item_t0.p_emailid =?) AND (item_t0.TypePkString=? )
Aug 31, 2015 6:51:35 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [DispatcherServlet] in context with path [/store] threw exception [Request processing failed; nested exception is de.hybris.platform.servicelayer.search.exceptions.FlexibleSearchException: missing values for [emailId, productCode], got {13=8796135981138, issent=false, productcode =0100, emailid ='hybrisa@gmail.com'}] with root cause
de.hybris.platform.jalo.flexiblesearch.FlexibleSearchException: missing values for [emailId, productCode], got {13=8796135981138, issent=false, productcode =0100, emailid ='hybrisa@gmail.com'}[HY-0]
at de.hybris.platform.persistence.flexiblesearch.TranslatedQuery.removeUnusedValues(TranslatedQuery.java:274)
at de.hybris.platform.jalo.flexiblesearch.FlexibleSearch.search(FlexibleSearch.java:1423)
at de.hybris.platform.jalo.flexiblesearch.FlexibleSearch.search(FlexibleSearch.java:1627)
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService$2.execute(DefaultFlexibleSearchService.java:374)
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService$2.execute(DefaultFlexibleSearchService.java:1)
at de.hybris.platform.servicelayer.session.impl.DefaultSessionService.executeInLocalView(DefaultSessionService.java:88)
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.getJaloResult(DefaultFlexibleSearchService.java:363)
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.search(DefaultFlexibleSearchService.java:164)
at de.hybris.merchandise.core.notifystock.NotifyStockServices.isAlreadyExists(NotifyStockServices.java:118)
at de.hybris.merchandise.facades.NotifyStock.impl.NotifyStockFacadeImpl.isAlreadyExists(NotifyStockFacadeImpl.java:51)
at de.hybris.merchandise.storefront.controllers.misc.AddToCartController.verifyEmail(AddToCartController.java:132)

HAC 中的工作查询:

  select {p:PK} From {NotifyStock AS p} WHERE {p:status}=0 AND {p:productId}=0100 AND {p:emailId}='ertsergt@gmail.com'

灵活搜索查询(不工作):

    final StringBuilder builder = new StringBuilder();
builder.append("SELECT {p:").append(ItemModel.PK).append("} ");
builder.append("FROM {").append(NotifyStockModel._TYPECODE).append(" AS p} ");
builder.append("WHERE ").append("{p:").append(NotifyStockModel.STATUS).append("}").append("=?isSent ");
builder.append("AND ").append("{p:").append(NotifyStockModel.PRODUCTID).append("}").append("=?productCode ");
builder.append("AND ").append("{p:").append(NotifyStockModel.EMAILID).append("}").append("=?emailId ");



final String email = "\'" + notifyStockModel.getEmailId() + "\'";
final FlexibleSearchQuery query = new FlexibleSearchQuery(builder.toString());
query.setNeedTotal(true);
query.addQueryParameter("isSent", Boolean.FALSE);
query.addQueryParameter("productCode ", notifyStockModel.getProductId());
query.addQueryParameter("emailId ", email);

当我在 HAC 中触发上述查询时,查询工作正常,但是当我使用灵活搜索触发相同的查询时,我遇到了一些 flexiblesarch 异常。有人能告诉我我的灵活搜索查询中的错误是什么吗?任何帮助都会受到赞赏?

最佳答案

除了 Shresht 已回答的内容之外,始终养成在参数映射中使用字段名称常量的习惯。

示例:

query.addQueryParameter(NotifyStockModel.PRODUCTID, notifyStockModel.getProductId());query.addQueryParameter(NotifyStockModel.EMAILID, email);

以上语法永远不会导致问题。同样对于此类直接匹配查询,我建议您使用灵活搜索的以下方法:

flexibleSearchService.getModelByExample(示例)

这会产生更易于维护的代码。查看 wiki 了解更多信息。

关于mysql - 灵活搜索错误 : missing values,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32313139/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com