selectOneMenu в качестве фильтра в файле данных Primefaces показывает "записи не найдены" каждый раз
Я пытаюсь реализовать selectOneMenu в качестве фильтра в Primefaces, датируемых с помощью этого. Когда я пытаюсь отфильтровать данные, он показывает, что записи не найдены каждый раз. Пожалуйста, дайте мне знать, если я что-то упустил.
<p:column filterBy="#{book.timeSlotId}" filterMatchMode="exact">
<f:facet name="header">
<h:outputText value="#{bundle.ListBookingDetailsTitle_timeSlotId}"/>
</f:facet>
<f:facet name="filter" >
<p:selectOneMenu onchange="PF('bookDetTable').filter()" >
<f:selectItem itemLabel="Select One" itemValue="#{null}"
noSelectionOption="true" />
<f:selectItems value="#{bookingTimeSlotsController.itemsAvailableSelectOne}"
var="timeSlotIdItem"
itemValue="#{timeSlotIdItem}" itemLabel="#{timeSlotIdItem.toString()}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{book.timeSlotId.toString()}"/>
</p:column>
Любая помощь очень ценится.
Класс сущности имеет методы hashCode() и equals
@Override
public int hashCode() {
int hash = 0;
hash += (timeSlotId != null ? timeSlotId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof BookingTimeSlots)) {
return false;
}
BookingTimeSlots other = (BookingTimeSlots) object;
if ((this.timeSlotId == null && other.timeSlotId != null) || (this.timeSlotId != null && !this.timeSlotId.equals(other.timeSlotId))) {
return false;
}
return true;
}
@Override
public String toString() {
return JsfUtil.convertTimetoString(timeSlotStime) + " - " + JsfUtil.convertTimetoString(timeSlotEtime);
}
Конвертер
@FacesConverter(forClass = BookingTimeSlots.class)
public static class BookingTimeSlotsControllerConverter implements Converter {
@Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0) {
return null;
}
BookingTimeSlotsController controller = (BookingTimeSlotsController) facesContext.getApplication().getELResolver().
getValue(facesContext.getELContext(), null, "bookingTimeSlotsController");
return controller.getFacade().find(getKey(value));
}
java.lang.Integer getKey(String value) {
java.lang.Integer key;
key = Integer.valueOf(value);
return key;
}
String getStringKey(java.lang.Integer value) {
StringBuilder sb = new StringBuilder();
sb.append(value);
return sb.toString();
}
@Override
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null) {
return null;
}
if (object instanceof BookingTimeSlots) {
BookingTimeSlots o = (BookingTimeSlots) object;
return getStringKey(o.getTimeSlotId());
} else {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "object {0} is of type {1}; expected type: {2}", new Object[]{object, object.getClass().getName(), BookingTimeSlots.class.getName()});
return null;
}
}
}
Может быть, я что-то пропустил. Буду очень рад, если кто-нибудь сможет выделить. Пожалуйста, помогите мне с этим!