1 Reply Latest reply on Mar 25, 2007 4:53 PM by sergeysmirnov

    Conversation in rerendered regions

    hispeedsurfer

      Hi

      I have build my own framework for create, update or delete entities, show lists from entity-table or edite a specific entity.
      So I have a abstrakt class to save/edit an entity

      public abstract class AbstractEditorBean<T extends BaseEntity> extends AbstractBusinessBean<T> implements Serializable


      an list entities

      public abstract class AbstractListBean<T extends BaseEntity> extends AbstractBusinessBean<T> implements Serializable


      Without a4j I have no problem so edit an entity and save the altered entry

       @TransactionAttribute(TransactionAttributeType.REQUIRED)
       @End
       public String save(){
       T entity = getEntity();
       preProcedure();
       try{
       if(state == NEW){
       em.persist(entity);
       }
       if(state == MODIFIED){
       em.merge(entity);
       }
       em.flush();
       }catch(Exception ex){
       //ejbCtx.setRollbackOnly();
       ex.printStackTrace();
       }
      
       return "save";
       }
      
      
       @SuppressWarnings("unchecked")
       @Begin(nested=true)
       public String edit(){
       try{
       T find = (T)em.find(getEntityClass(), id);
       setEntity(find);
       state = MODIFIED;
       }catch(Exception ex){
       ex.printStackTrace();
       }
      
       return "edit";
       }
      


      From website I select a entity from list. A new window is opend in rerendert region an the informations are displayed.
      In AbstractEditorBean the state is set to MODIFIED.
      When I save this changed entity and call save() method the entity is saved as new entity although the state was set to MODIFIED shortly before. (In save() the state is now NEW).

      This means there is no Seam conversation to take place?!?

      What I have to do to save state between rerendered regions?


      Thanks
      Andi