0 Replies Latest reply on Jul 18, 2008 10:06 PM by Nathan Thompson

    How to get EntityManager from Schedulable?

    Nathan Thompson Newbie


      I'm trying to implement a nightly job via the org.jboss.varia.scheduler.Scheduler mbean that requires access to the database.  I'm unsure about the correct way to obtain a reference to the database/EntityManager.

      If I try

              EntityManagerFactory emf = Persistence 
              this.em = emf.createEntityManager();

      I get errors about there not being a transaction...

      What is the correct way to do this?