1 Reply Latest reply on Feb 4, 2009 3:44 PM by Jozef Hartinger

    Calling an EntityHome remove inside of a timer...

    Vasilica Petcu Newbie

      HI,


      Does anyone know why  this code doesn't work  ???


      It supose to delete a row from database...:)


      This codce it is called inside of a timer



      package pt.itsector.email.job;
      
      import java.util.Date;
      import java.util.Iterator;
      import java.util.List;
      
      import javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      
      import org.domain.ctiproxy.entity.Email;
      import org.domain.ctiproxy.session.EmailHome;
      import org.domain.ctiproxy.session.EmailList;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Out;
      import org.jboss.seam.annotations.async.Expiration;
      import org.jboss.seam.annotations.async.IntervalDuration;
      import org.jboss.seam.log.Log;
      
      @Stateless
      @Name("emailRemoveHandler")
      public class EmailRemoveHandlerBean implements EmailRemoveHandler
      {
          
          @Logger Log log;
          
          @In(create=true) @Out EmailHome emailHome;
          
       
           public void processRecurringEmailRemove(@Expiration Date date, @IntervalDuration Long interval) {
               log.info("Starting remove Process...");
               log.info("email instance before : " + emailHome.getInstance().getEmailId());
               emailHome.remove();
               emailHome.getEntityManager().remove(emailHome.getInstance());
               log.info("email instance after : " + emailHome.getInstance().getEmailId());
           }
      
      }