title: ActionListener doesn't call action in 'Bean View' when there is already a record in the database (Primefaces + Hibernate + JPA)
body: <p>I have an error, which may be simple, but I'm not able to resolve it.</p>
  <p>I have a simple registration screen, where everything works fine, and I've a p:selectOneMenu that brings me a list of customers to choose from (Convert works fine).</p>
  <p>However, when I try to save a record that the selected customer already has in my base, it doesn't save and it doesn't give an error, neither on console, it just leave p:selectOneMenu with a red border, my method isn't even called on my bean view.</p>
  <p>Main Class:</p>
  <pre><code>@Entity
  @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
  public class EmailGds implements Serializable {
  
  private static final long serialVersionUID = 1L;
  
  public EmailGds() {
  }
  
  @Id
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = &quot;emails_gds_seq&quot;)
  @SequenceGenerator(name = &quot;emails_gds_seq&quot;, sequenceName = &quot;emailsgds_id_seq&quot;,     allocationSize = 1)
  @Column
  private Long id;
  
  @IdentificaCampoPesquisa(descricaoCampo = &quot;Cliente do Projeto&quot;, campoConsulta = &quot;c_id&quot;, principal = 1)
  @OneToOne(fetch = FetchType.LAZY, orphanRemoval = false)
  @JoinColumn(name = &quot;c_id&quot;, foreignKey = @ForeignKey(name = &quot;none&quot;, value =     ConstraintMode.NO_CONSTRAINT), nullable = false, unique = true)
  private v_clientesgds c_id; //This guy is my field with problem
  ...
  //Getters and setters
  </code></pre>
  <p>My p:selectOneMenu:</p>
  <pre><code>&lt;p:selectOneMenu id=&quot;conteinerCliente&quot; value=&quot;#{emailGdsMB.selectedEmailGds.c_id}&quot; filter=&quot;true&quot; filterMatchMode=&quot;contains&quot; rendered=&quot;#{emailGdsMB.selectedEmailGds.novo}&quot; &gt;
                          &lt;f:selectItems value=&quot;#{emailGdsMB.lstClientesGds}&quot; var=&quot;objClients&quot; itemValue=&quot;#{objClients}&quot; itemLabel=&quot;#{objClients.fantasy_name}&quot; /&gt;
                          &lt;p:ajax event=&quot;valueChange&quot; listener=&quot;#{emailGdsMB.analisaSelecao}&quot; process=&quot;@form&quot;/&gt;
                      &lt;/p:selectOneMenu&gt;
                      
  </code></pre>
  <p>Save button:</p>
  <pre><code>&lt;p:commandButton id=&quot;bt_save&quot; title=&quot;Salvar&quot; icon=&quot;pi pi-save&quot; actionListener=&quot;#{emailGdsMB.save}&quot; update=&quot;manage-content&quot; partialSubmit=&quot;false&quot; process=&quot;@this,@form&quot; immediate=&quot;false&quot; /&gt;
  </code></pre>
  <p>Save Function:</p>
  <pre><code>public void save() {
     System.out.println(&quot;Salvando Registro&quot;);
     try {
         if (validarCampoObrigatorio(this.selectedEmailGds)) {
             if (this.selectedEmailGds.getId() == null) {
                 selectedEmailGds.setStore_id(selectedEmailGds.getC_id().getStore_id());
                 selectedEmailGds.setUser_create(userSessao);
                 emailGdsDao.save(selectedEmailGds);
                 this.emailGdss = emailGdsDao.loadLista();
                 this.selectedEmailGds = new EmailGds();
                 FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(&quot;Email acesso ao GDS Adicionado&quot;));
             } else {
                 selectedEmailGds.setStore_id(selectedEmailGds.getC_id().getStore_id());
                 selectedEmailGds.setUser_update(userSessao);
                 emailGdsDao.save(selectedEmailGds);
                 this.emailGdss = emailGdsDao.loadLista();
                 this.selectedEmailGds = new EmailGds();
                 FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(&quot;Email acesso ao GDS Atualizado&quot;));
             }
             PrimeFaces.current().ajax().update(&quot;formEmailGds:messages&quot;, &quot;formEmailGds:dtable&quot;);
         }
     } catch (Exception e) {
         System.err.println(&quot;Erro ao salvar EmailGDS &quot;+e);
     }
  }
  </code></pre>
  <p>In short, when I select a customer that has never been saved, it performs all, including the event 'valueChange' ajax. But if I select a client that has already been saved (on database table), it doesn't execute anything, neither the save method nor the AJAX 'valueChange' event.</p>
  <p>My converter is working fine</p>
  <p>If I put in the save button: ajax=&quot;false&quot;, it returns the message:</p>
  <blockquote>
  <p>Validation error: value is not valid</p>
  </blockquote>
  <p>My environment:</p>
  <p>Jsf 2.2<br />
  Hibernate<br />
  Primefaces 8<br />
  Spring boot<br />
  Postgres</p>
  <p>PS: Update data works fine.</p>
  <p>EDIT 1:</p>
  <p>v_clientesgds is a view in my database.</p>
  <p>My Converter:</p>
  <pre class="lang-java prettyprint-override"><code>@FacesConverter(forClass = v_clientesgds.class)
  public class v_clientesgdsConverter implements Converter {
      private static Session session =     HibernateUtil.getSessionFactory().openSession();
  
      public Object getAsObject(FacesContext arg0, UIComponent arg1, String codigo) {
          if (codigo != null &amp;&amp; !codigo.isEmpty()) {
              System.out.println(&quot;Converter getAsObject: &quot; + codigo);
              v_clientesgds ret = session.get(v_clientesgds.class, new Long(codigo));
              System.out.println(&quot;Customer name converter: &quot; + ret.getFantasy_name());
              return ret;
          }
          System.out.println(&quot;FIM Executando converter getAsObject: &quot; + codigo);
          return codigo;
      }
  
      public String getAsString(FacesContext arg0, UIComponent arg1, Object objeto) {
          if (objeto != null) {
              v_clientesgds c = (v_clientesgds) objeto;
              return c.getC_id() != null &amp;&amp; c.getC_id() &gt; 0 ? c.getC_id().toString() : null;
          } else {
              return null;
          }
      }
  }
  </code></pre>