0 Replies Latest reply on Feb 15, 2011 11:59 AM by Alex Freitas

    Object return a null value for id

    Alex Freitas Newbie

      Hi fellas,
      i'm beginner with Jboss Seam,
      and i got this problem when i try to edit an object
      both persist and merge are handled in the method below:




      public void save() {
      try {
      if (cabine.getIdCabine() == null) {
      entityManager.persist(cabine);
      cabines.add(cabine);
      entityManager.flush();
      facesMessages.add("Cabine salva com sucesso no sistema");
      } else {
      entityManager.merge(cabine);
      facesMessages.add("Cabine atualizada com sucesso no sistema");
      }
      
      } catch (PersistenceException e) {
      facesMessages.add("Ocorreu erro: " + e.getMessage());
      }
      }





      even when i try to edit the objectt,



      if (cabine.getIdCabine() == null)



      returns true.


      this method work perfectly when the class has no relationships.


      Thanks already.