[jboss-user] [EJB 3.0] - EntityManager

dobbo do-not-reply at jboss.com
Thu May 29 05:28:24 EDT 2008


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4154201#4154201

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4154201



More information about the jboss-user mailing list