1 Reply Latest reply on Jul 16, 2009 2:12 PM by spoonman

    Simple EntityQuery with a4j support doesn't work

    spoonman

      This is simple example taken from Seam In Action, page 405:


      <s:decorate id="scoreField" template="layout/edit.xhtml">
        <ui:define name="label">Total score:</ui:define>
        <h:inputText id="score" value="#{round.totalScore}">
          <a:support event="onblur" reRender="scoreField" ajaxSingle="true"/>
        </h:inputText>
      </s:decorate>
      


      This works fine, model gets updated and database changes are commited after every Ajax call as expected.


      However, when I want to iterate over a list (EntityQuery#getResultList) I face a problem. I can see that model is updated, but there are no changes in database. When I refresh a page all changes to model are gone. Can someone explain it to me why? Thank you in advance. Here is en example:


      <rich:dataGrid value="#{roundList.resultList}" var="round">
      
        <s:decorate id="scoreField" template="layout/edit.xhtml">
          <ui:define name="label">Total score:</ui:define>
          <h:inputText id="score" value="#{round.totalScore}">
            <a:support event="onblur" reRender="scoreField" ajaxSingle="true"/>
          </h:inputText>
        </s:decorate>
      
      </rich:dataGrid>
      



        • 1. Re: Simple EntityQuery with a4j support doesn't work
          spoonman

          In case some of you have similar problem this was my solution:


          There was a faulty annotation @Column(nullable = false, updatable = false) on Round#getTotalScore() so even if JPA tried to update this entity with only this one field changed - it didn't do nothing. Entity was changed, but only this one field has changed, thus no need to update to database since updatable = false was set.