[jboss-user] [JBoss Seam] - Uncaught ValidationException closes transaction in validatio

atzbert do-not-reply at jboss.com
Wed Oct 10 05:18:25 EDT 2007


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,
Tino

my xhtml:

  | ...
  | <q:field helpText="Please enter an alpha-numerical value" fieldId="receipt_receiptId">
  |                 <h:inputText styleClass="editEntity"
  |                              id="receipt_receiptId"
  |                              validator="#{receiptHome.validateUniqueReceiptId}"
  |                              value="#{receiptHome.instance.receiptId}"
  |                              required="true"
  |                              requiredMessage="Please enter a valid receipt ID" >
  |                 </h:inputText>
  |             </q:field>
  |             <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..."/>
  |                 </h:selectOneMenu>
  |             </q:field>
  | ...
  | 
my validation method:
    public void validateUniqueReceiptId(FacesContext context,
  |         UIComponent component, Object value) throws ValidatorException {
  |         if(isManaged() && getInstance().getReceiptId().equals(value.toString())){
  |             return;
  |         }
  |         List existing = fetchReceiptList(value);
  |         if (existing.size() > 0) {
  |             throwValidationError("Receipt with this ID already exists",
  |                 component);
  |         }
  |     }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093366#4093366

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093366



More information about the jboss-user mailing list