1 Reply Latest reply on Oct 10, 2007 9:27 AM by Pete Muir

    Uncaught ValidationException closes transaction in validatio

    Tino Nitze Newbie

      Hi All,

      Is that true? I read a comment somewhere which was saying that any uncaught exception would cause Seam to close the opened connection (hence preventing the next phases from accessing it...?)

      I noticed that when adding a validation method to the input tag that queries the database and afterwards throws an ValidationException if not valid. Then the selectItems (on the same rerendered page) would try to execute a entityquery.getResultList() which results in a transaction - closed exception...

      Did I interpret this correctly? If so, is there any way around it?

      Any help or hint appreciated,

      my xhtml:

      <q:field helpText="Please enter an alpha-numerical value" fieldId="receipt_receiptId">
       <h:inputText styleClass="editEntity"
       requiredMessage="Please enter a valid receipt ID" >
       <q:field fieldId="receipt_rep">
       <h:selectOneMenu id="receipt_rep" value="#{receiptHome.instance.rep}">
       <si:selectItems value="#{allUserList.resultList}" var="user" label="#{user.stringRep}" noSelectionLabel="Select one..."/>

      my validation method:
      public void validateUniqueReceiptId(FacesContext context,
       UIComponent component, Object value) throws ValidatorException {
       if(isManaged() && getInstance().getReceiptId().equals(value.toString())){
       List existing = fetchReceiptList(value);
       if (existing.size() > 0) {
       throwValidationError("Receipt with this ID already exists",