[jboss-user] [JBoss Seam] - Problem with injecting EntityManager when invoking action wi

tuxzilla do-not-reply at jboss.com
Wed Jun 27 03:06:31 EDT 2007


I have a list view page that pops up within page a send-to-friend form (using display block/none toggle). The send to friend form is submitted via <a:commandButton action="#{sendToFriend.send}"/>. The problem is that when the form is submitted, I always get the exception saying that the entityManager in the sendToFriend bean is null. I configured the entityManager the standard way, with auto-create and Conversation context.
 
  |    <core:managed-persistence-context name="entityManager"
  |                               auto-create="true"
  |                persistence-unit-jndi-name="java:/myEntityManagerFactory"/>
  | 

The sendToFriendBean is of EVENT scope:

  | @Name("sendToFriend")
  | @Scope(ScopeType.EVENT)
  | @AutoCreate
  | public class SendToFriend {
  | ...
  |     @In
  |     private EntityManager entityManager;
  | ...
  |     public void send() {
  |          ...
  |     }
  | }
  | 
I did some debugging, and found out that when BijectionInterceptor was trying to inject entityManager, there was no conversationContext alive (which was the scope of the entityManager). So no entityManager was created. How do I solve this problem? A related question is that, I have many other beans with EVENT scope and entityManager injection. How can they work, with conversation scope alive without me starting it?

Thanks.


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

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



More information about the jboss-user mailing list