[jboss-user] [JBoss Seam] - Re: EntityManager not injected in onMessage method

rmcalderero do-not-reply at jboss.com
Wed Feb 13 03:26:02 EST 2008


As a workaround, we have brought our code reading from the queue out of the onMessage method, an put it inside another asynchronous method periodically executed (quartz).

And now the entity manager is correctly being injected and we can merge our object. 

	@Asynchronous
  | 	public void receiveMessage(@Expiration Date begin, 
  | 							@IntervalDuration Long interval) {
  | 		
  | 		log.debug("Se ejecuta el Servicio de Resultados......");
  | 
  | 		try {
  | 			
  | 			Message message = consumer.receiveNoWait();
  | 			
  | 			if (message!=null) {
  | 
  | 				AnalisisCerrado ac = (AnalisisCerrado) ((ObjectMessage) message).getObject();
  | 				ac = em.merge(ac);
  | 				.....
  | 				
  | 			}
  | 		}
  | 		
  | 	}
So it seems there are some kind of issue in the way seam manages injection in onMessage methods (or at least we havent found any solution; as i explained we have a tipical JPA-tomcat configuration). I think seam people should take a look on this.

If any other people can give some feedback on the topic it will be highly appreciated.




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

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



More information about the jboss-user mailing list