0 Replies Latest reply on May 29, 2008 5:28 AM by Steve Dobson

    EntityManager

    Steve Dobson Newbie

      I'm creating a garbage collection service, you know the kind of thing I'm sure:

      @Entity
      @EntityListeners({GarbageCollectorService.class})
      public class MyEntity {
       ....
      }


      @Service(objectName="pugwash:service=garbageCollector")
      @Management(GarbageCollectorManagement.class)
      public class GarbageCollectorService
       implements GarbageCollectorManagement {
      
       ....
      
       @PreRemove
       public void preRemove(final Object obj) {
       if (obj instanceof MyEntity)
       preRemove((MyEntity) obj);
       }
      
       ...
      }


      With the other service I've written the EntityManager was set up I assume because it got inherited with the calling of method from the session bean. But my garbage collection service is never called from a session bean, or anything else I write, so it doesn't appear to get configured.

      Is there away of annotating/getting a valid EntityManager?

      Thanks for any advice in advance.