[jboss-user] [JBoss Seam] - CascadeType.Remove and asynchronous method

hispeedsurfer do-not-reply at jboss.com
Sun Dec 9 14:10:41 EST 2007


Hi,

I have a entity that is in relation with some other entities with cascade type 'remove'.

When I call an action from website to remove (entityManager.remove(userQuery);) an specific entity all other entities are also removed as expected.

But if the same is called inside an asynchronous method only the first entity is removed(userQuery in this case).

Here the quartz scheduled class
@Name("processor")
  | @AutoCreate
  | public class ReportProcessor {
  |     
  |     @In 
  |     EntityManager entityManager;
  | 
  |     @Logger Log log;
  | 
  |     @Asynchronous
  |     @Transactional
  |     public QuartzTriggerHandle scheduleDeleteReport(@Expiration Date when, UserQuery userQuery) 
  |     { 
  |         userQuery = entityManager.merge(userQuery);
  |         
  |         log.info("[#0] Processing userQuery #1", System.currentTimeMillis(), userQuery.getId());
  | 
  |         if (userQuery.getActive()) {
  |         	entityManager.remove(userQuery);
  |         }
  | 
  |         return null;
  |     }
  | }

UserQuery for example is joined with 
@OneToMany(mappedBy="userQuery", cascade=CascadeType.REMOVE)


Is there a solution get this working or what's the cause only the first entity is removed?

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

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



More information about the jboss-user mailing list