我正在尝试使用 setPropertyActionListener 设置枚举属性,但我不知道该怎么做。这是实体:
@Entity
public class Invoice {
    public enum InvoiceStatus { ACTIVE, CANCELED }
        ...
        @Enumerated(EnumType.STRING)
    private InvoiceStatus status;
        ...
        public InvoiceStatus getStatus() {
        return status;
    }
    public void setStatus(InvoiceStatus status) {
        this.status = status;
    }
这是命令按钮,假设使用 setPropertyActionListener 将状态设置为 ACTIVE
   ...
  <h:form id="invoiceCreatedSuccessfully">
        <p:dialog header="#{msg['title.success']}" widgetVar="invoiceCreatedSuccessfullyDialog" resizable="false" showEffect="fade" hideEffect="fade">  
            <h:panelGrid columns="2" rows="3" style="margin-bottom: 10px">  
                <h:outputText value="#{msg['message.invoiceCreatedSuccessfully']}" />
            </h:panelGrid>  
            <p:commandButton value="#{msg['label.acknowledged']}" actionListener="#{invoiceManager.reload}" action="viewInvoices">
                <f:setPropertyActionListener target="#{invoiceManager.invoice.status}" value="ACTIVE" />
            </p:commandButton>
        </p:dialog>
    </h:form>
未报告错误,但未设置数据库中的“状态”字段。有人能告诉我为什么吗?