我正在尝试按照SDK教程中的步骤20创建一个实体。但是当我使用命令mvn clean install
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.businesspartner.AddressEmailAddress;
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.businesspartner.BusinessPartnerAddress;
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.businesspartner.BusinessPartnerRole;
我看到以下错误。
[ERROR] /C:/Users/sanke/workspace/Businesspartners_cloudfoundry/application/src/main/java/com/yash/cf/Businesspartners_cloudfoundry/BusinessPartnerServlet.java:[81,17] toEmailAddress(java.util.List中) 有私人访问权限 com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.businesspartner.BusinessPartnerAddress.BusinessPartnerAddressBuilder [错误] /C:/Users/sanke/workspace/Businesspartners_cloudfoundry/application/src/main/java/com/yash/cf/Businesspartners_cloudfoundry/BusinessPartnerServlet.java:[93,17] toBusinessPartnerAddress(java.util.List中) 有私人访问权限 com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.businesspartner.BusinessPartner.BusinessPartnerBuilder [错误] /C:/Users/sanke/workspace/Businesspartners_cloudfoundry/application/src/main/java/com/yash/cf/Businesspartners_cloudfoundry/BusinessPartnerServlet.java:[94,17] toBusinessPartnerRole(java.util.List中) 有私人访问权限 com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.businesspartner.BusinessPartner.BusinessPartnerBuilder
答案 0 :(得分:5)
博客仍然引用1.5.0版。您遇到的错误表明您使用的是更新版本&gt; = 1.6.0,其中导航属性的签名稍有变化。例如,代替toEmailAddress(List<AddressEmailAddress> value)
的方法已经重新设计为emailAddress(AddressEmailAddress... value)
。有关此事,请参阅release notes for 1.6.0。
因此,请将您的代码更改为以下内容:
final BusinessPartnerAddress businessPartnerAddress = BusinessPartnerAddress.builder()
.country(country)
.cityName(city)
.emailAddress(emailAddress)
.build();
该教程也已更新。