long conversations in rich client applications - orchestra
I can report back that it all works for rich client applications. Even though it uses spring scopes (where one could just use annotations or conversation names), the framework works. For rich clients, you need a different configuration approach than listed in the myfaces documentation that composes the umbrella project of which orchestra is a subproject.
You need to do this once somewhere:
Here, I have a method in the same class that has
getBean()obtain a bean from the toplevel application context. In that toplevel context I have the following bean definitions:
<bean id="conversationLogger" class="org.apache.myfaces.orchestra.conversation.basic.LogConversationMessager"/>
<bean id="orchestraFramework" class="org.apache.myfaces.orchestra.frameworkAdapter.local.LocalFrameworkAdapter"
and I also include the following in my imported orchestra scopes xml configuration
<import resource="classpath*:/META-INF/spring-orchestra-init.xml" />
<entry key="conversation.manual"><bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope"></bean>
<bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope"><property name="advices">
<bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope"><property name="advices"><list></list></property> </entry>
<property name="entityManagerFactory" ref="defaultSessionFactory"></property></property>
That's about it. Now when you use an object whose bean definition has the scope defined as one of the scopes above, your object will have the same session object available on the thread for any method call in that class. Note that you need to watch your transaction boundaries so that the thread bound session has the correct transactional behavior you desire.
I know the formatting is completely messed up on the above configuration files. Hopefully, you can figure it out from what is posted here.