0 Replies Latest reply on May 18, 2009 4:23 PM by mvpc

    EJB3, JSF and Ajax: Exception when cleaning form object attr

      Hello People!

      I am having some trouble with a ajax form. After i have inserted the object on the database through ejb sessionbean and call a method to clean the jsf form by setting null the managed bean object attributes. I receive a message (Transaction Fail) from jsf PhaseListener mecanism, and the operation is undone.
      My jsf form is something like this:

      <h:inputText id="address" value="#{managedBean.email.address}" ></h:inputText>

      Then i have a method that insert in the database through ejb sessionbean and set the email attribuetes to null, include the id.

      After that i have a method that list the emails. At tgis point it throws an exception on the log, something like this:

      javax.persistence.PersistenceException: org.hibernate.HibernateException: identifier of an instance of my.entity.Email was altered from 77 to null
      at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
      at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:76)
      at my.sessionbean.EmailSessionBean.list(EmailBean.java:54)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      .
      .
      .
      .



      The interesting thing is that I can perform the operation perfectly with other form with the same template. I think is something related with EJB objects beeing used ad the attribute on the jsf form.
      So if anyone have any tip, please, let me know. I have searched through out the internet and found no solution.

      Thanks!!