Java 未调用SelectOne菜单中的Setter例程

Java 未调用SelectOne菜单中的Setter例程,java,jsf,primefaces,jsf-2,Java,Jsf,Primefaces,Jsf 2,我使用的是Primefaces 6.1,其中一个selectOneMenu出现问题。我已将页面缩小为SelectOne菜单项,但无法确定问题所在 xhtml页面: #{interfaceFileItem.fileName} 转换器: @ManagedBean @会议范围 @命名(“interfaceFileConverter”) 公共类InterfaceFileConverter实现转换器{ 私有最终记录器=Logger.getLogger(this.getClass().getName(

我使用的是Primefaces 6.1,其中一个selectOneMenu出现问题。我已将页面缩小为SelectOne菜单项,但无法确定问题所在

xhtml页面:


#{interfaceFileItem.fileName}
转换器:

@ManagedBean
@会议范围
@命名(“interfaceFileConverter”)
公共类InterfaceFileConverter实现转换器{
私有最终记录器=Logger.getLogger(this.getClass().getName());
@注入
专用接口ejbFacade;
私有整数getKey(字符串值){
整数键=Integer.valueOf(值);
返回键;
}
公共字符串getAsString(FacesContext fc、uic组件uic、对象对象){
if(object==null)返回null;
if(InterfaceFile的对象实例)
返回字符串.valueOf(((接口文件)对象).getInterfaceFileId());
返回null;
} 
@凌驾
公共对象getAsObject(FacesContext上下文、UIComponent组件、字符串值){
if(value==null | | value.length()==0){
logger.info(“接口转换器:null”);
返回null;
}
InterfaceFile InterfaceFile=this.ejbFacade.findInterfaceFile(getKey(value));
info(“接口转换器:”+interfaceFile.getInterfaceFileId());
返回接口文件;
}
}
豆子:

@SessionScoped
@ManagedBean
@命名(value=“bankAccountEntryClearing”)
公共类BankAccountEntryClearing扩展AbstractHouseController实现可序列化{
私有静态最终长serialVersionUID=1L;
私有最终记录器=Logger.getLogger(this.getClass().getName());
@注入
专用接口ejbFacade;
私有接口文件InterfaceFile=null;
私有整数houseId;
私有列表接口文件=null;
公共银行账户清算(){
超级(接口文件类);
}
@施工后
公共void init(){
super.setFacade(ejbFacade);
}
公共列表getItems(){
if(this.getHouseId()==null)
返回null;
if(this.getHouseId()!=this.houseId){
interfaceFiles=ejbFacade.getInterfaceFiles(this.getHouseId(),1);
}
返回接口文件;
}
公共接口文件getSelectedInterfaceFile(){
info(“接口Bean getter”);
返回接口文件;
}
公共无效集合SelectedInterfaceFile(InterfaceFile InterfaceFile){
info(“接口Bean setter:+interfaceFile.getFileName());
this.interface文件=interface文件;
}
公共字符串getFileName(){
如果(this.interfaceFile!=null)
返回此.interfaceFile.getFileName();
返回“”;
}
}
项目已加载到prober,并且可以选择。选择项后,将调用来自转换器的getAsObject,但不会调用setter例程

16:55:23411信息[com.np.propmgmt.controller.BankAccountEntryClearing](默认任务-30)接口Bean getter
16:55:23412信息[com.np.propmgmt.controller.BankAccountEntryClearing](默认任务-30)接口Bean getter
16:55:27772信息[com.np.propmgmt.converter.InterfaceFileConverter](默认任务-48)接口转换器:69

我找到了一个后援,解决了这个问题。原因是实体类对象接口文件本身。 这个JPA实体类是唯一一个由EclipseJPA工具生成的实体类。在这种情况下,没有“equals”和“hashCode”函数 与主键一起生成。在选择该项时,将返回的InterfaceFile(从getAsObject)的“selectOneMenu”比较为 列表(来自getItems)并失败。添加“”时,将显示验证错误

在将这两个函数添加到InterfaceFile实体类之后,一切都正常工作

这和