[jboss-user] [JBoss Seam] - Re: Scope of EntityManager

dapeng do-not-reply at jboss.com
Tue Dec 18 07:49:34 EST 2007


anonymous wrote : The way your have everything configured Seam should never be attempting to create a transaction before a conversation is created.
  | 

Can you elaborate on this statement. I already posted my configuration. I enabled the seam transaction management and using a layered architecture a spring-based application layer. The entry point into my application is for example a list page, which uses a query to show a list of results. The action executing the query has a page scope, because I don't need to start any conversation at that timepoint. 

According to my understanding, a non-longrunning should be started upon every request. The error I get is not reproducable. But once I was able to cathc it in my debug session. There I got a null entity manager in the line 59 o f the class SeamManagedEntityManagerFactory.       
EntityManager em = (EntityManager)  component.getInstance(persistenceContextName);

The only explanation I have is that somehow the conversation context is not yet activated at that time, so the line 1865 in the class Component is not executed.

result = component.newInstance();

But why sometimes the conversation is not activated for an incoming request, is not clear for me. It seems the conversation context will only be activated after the restore view phase in the seamphase listener. Could there be some cases, where only the render view phase is invoked without the restore view phase, so that conversation context was no initialized?

Any hint will be appreciated.

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

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



More information about the jboss-user mailing list