使用内部联接,右联接的Openbravo URL查询构建

时间:2016-06-02 12:14:49

标签: hql openbravo

我想查询openbravo以使用他们的电话号码过滤客户端。我有两个表BusinessPartner和BusinessPartnerLocation。 BusinessPartnerLocation具有phonePartner字段,该字段是BusinessPartner对象的id。 我试过这样的http://server.opentix.es:3013/openbravo/org.openbravo.service.json.jsonrest/BusinessPartner?_where=e%20IN%20(%20SELECT%20DISTINCT%20bp%20FROM%20BusinessPartner%20RIGHT%20JOIN%20BusinessPartnerLocation%20ON%20BusinessPartner.id=BusinessPartnerLocation.businessPartner%20WHERE%20BusinessPartnerLocation.phone='5555555')

没有%20 s或没有e In()仍然无法正常工作。我该如何为此构建查询。谢谢

1 个答案:

答案 0 :(得分:0)

you should use below code that help to get both location geographical and businesspartner location without write hql.   

    bPartner = OBDao.getOBObjectListFromString(BusinessPartner.class,
            strcBpartnerId);

      List<Location> ls = bPartner.getBusinessPartnerLocationList();

                    if (!ls.isEmpty()) {
                     org.openbravo.model.common.businesspartner.Location Location lcbpartner = ls.get(0);
                   org.openbravo.model.common.geography.Location   lcgeo = lcbpartner.getLocationAddress();
                     org.openbravo.model.common.businesspartner.Location  lcbp = lcbpartner;
                    }