Websphere commerce 如何获取catalogentryID的零件说明
我正在使用IBM WCS 7 aurorab2b商店 我想检索用户输入的Websphere commerce 如何获取catalogentryID的零件说明,websphere-commerce,wcs,Websphere Commerce,Wcs,我正在使用IBM WCS 7 aurorab2b商店 我想检索用户输入的零件号的描述。我得到了catentryID=14726和langIdas-1。我尝试了以下方法,在创建CatalogentryScriptionAccessBean try{ String catentID = catlogBean.getCatalogEntryReferenceNumber(); long catentryID = Long.parseLong(catentID); Intege
零件号的描述。我得到了catentryID
=14726和langId
as-1。我尝试了以下方法,在创建CatalogentryScriptionAccessBean
try{
String catentID = catlogBean.getCatalogEntryReferenceNumber();
long catentryID = Long.parseLong(catentID);
Integer langID = Integer.parseInt(getLanguageId());
System.out.println("catEntryID:"+catentryID);
System.out.println("langID:"+langID+"");
CatalogEntryDescriptionAccessBean catlogDescriptionBean = new CatalogEntryDescriptionAccessBean(catentryID,langID);
if(catlogDescriptionBean == null)
System.out.println("catlogDescriptionBean is null");
else
System.out.println("catlogDescriptionBean is not null");
description = catlogDescriptionBean.getShortDescription();
}
catch(Exception e){
System.out.println("EXCEPTION IN DESCRPTN");
e.printStackTrace();
}
请注意,调用accessbean的构造函数将映射到EJB主接口中相应的ejbCreate方法。这意味着您正在创建已存在的新记录
使用以下方式使用access Bean获取描述:
CatalogEntryAccessBean catEntryAB = new CatalogEntryAccessBean();
catEntryAB.setInitKey_catalogEntryReferenceNumber(catentry_id);
catEntryAB.refreshCopyHelper();
CatalogEntryDescriptionAccessBean catEntryDescAB = catEntryAB.getDescription(langId);
您需要捕获bean EJB抛出的适当异常,并从catentrydscab对象获取描述
更新:实现相同目标的第二种方法:
String longDesc = CatalogEntryCache.getDescription(catEntryAB ,
this.commandContext.getLanguageId(), getStoreId()).getLongDescription()
请注意,在jsp中,WCS使用Solr获取生产信息,请阅读ProductDisplay.jsp以查看所使用的wcf服务和相应的访问/搜索配置文件
希望这能回答你的问题
谢谢
Abed谢谢您的回复!我通过迭代findByPartNumbersAndStore(java.lang.String[]partNumbers,java.lang.Integer storeId)返回的枚举来获取CatalogEntryAccessBean实例,因此在获取CatalogEntryAccessBean实例后,我可以通过getCatalogEntryReferenceNumber获取catentryID。所以现在我必须再次执行catEntryAB.setInitKey\u catalogEntryReferenceNumber(catentry\u id)???catentId已经存在,是否需要在之前再次传递否,如果您已经从以前的操作中准备好了access bean,那么您可以再次调用setInitKey\u catalogEntryReferenceNumber(catentry\u id)来使用它。CatalogEntryAccessBean catalogAccessBean=new CatalogEntryAccessBean();枚举枚举=catalogAccessBean.findByPartNumbersAndStore(partNumberArray,getStoreId());而(enumeration.hasMoreElements()){CatalogEntryAccessBean catlogBean=(CatalogEntryAccessBean)enumeration.nextElement();CatalogEntryDescriptionAccessBean catlogDescriptionBean=CatalogBean.getDescription();对于CatalogBean.getDescription();m获取重复的异常使用getDescription(langId)我需要查看异常堆栈跟踪