Assuming MyTask implements Runnable and takes a Session in it's
constructor:

Either
   @Startup
   public static void scheduleMyJob(PeriodicExecutor executor, Session
hibernateSession) {
       Runnable mytask = new MyTask(hibernateSession);
       executor.addJob(new IntervalSchedule(1000000L), "Do Stuff", myTask);
   }

Or
   @Startup
   public static void scheduleMyJob(PeriodicExecutor executor, @Autobuild
MyTask myTask) {
       executor.addJob(new IntervalSchedule(1000000L), "Do Stuff", myTask);
   }

Reply via email to