Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I used the EJB3InvokerJob to invoke the methods of my EJB. Then I created my jobs that extends the EJB3InvokerJob, put the parameters of what EJB and method it should call and then call the super.execute().</p> <p>The EJB3InvokerJob can be found here: <a href="http://jira.opensymphony.com/secure/attachment/13356/EJB3InvokerJob.java" rel="nofollow">http://jira.opensymphony.com/secure/attachment/13356/EJB3InvokerJob.java</a></p> <p>My Job is looking like this:</p> <pre><code>public class BuscaSistecJob extends EJB3InvokerJob implements Job{ private final Logger logger = Logger.getLogger(this.getClass()); @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { JobDataMap dataMap = jobExecutionContext.getMergedJobDataMap(); dataMap.put(EJB_JNDI_NAME_KEY, "java:app/JobService"); dataMap.put(EJB_INTERFACE_NAME_KEY, "br.org.cni.pronatec.controller.service.JobServiceLocal"); dataMap.put(EJB_METHOD_KEY, "buscaSistec"); Object[] arguments = new Object[1]; arguments[0] = jobExecutionContext.getTrigger().getStartTime(); dataMap.put(EJB_ARGS_KEY, arguments); Class[] argumentTypes = new Class[1]; argumentTypes[0] = Date.class; dataMap.put(EJB_ARG_TYPES_KEY, argumentTypes); super.execute(jobExecutionContext); } } </code></pre> <p>And my EJB is like this:</p> <pre><code>@Stateless @EJB(name="java:app/JobService", beanInterface=JobServiceLocal.class) public class JobService implements JobServiceLocal { @PersistenceContext private EntityManager entityManager; @Resource private UserTransaction userTransaction; @Override public void buscaSistec(Date dataAgendamento) { // Do something } </code></pre> <p>I expect to help someone.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload