I think you could define a scope called 'conversation.manual.dms' or similar, and configure that to use your persistence context factory that is set up for 'dms' access. Then you can declare bean A as belonging to scope 'conversation.manual', and B as belonging to scope 'conversation.manual.dms'.
Of course I haven't tried it; I've never had a need to deal with multiple persistence contexts. But I don't see why it wouldn't work. You can inject a bean B from one conversation into a bean A in a different conversation using normal Spring functionality. When A calls a method on B, then the "current conversation" gets switched to B's conversation automatically, including setting the right persistence context. Anything bean B does will be within its own persistence context. Regards, Simon alsha schrieb: > Hi Simon, > > thank you for fast reply! > > I see the problem. > Anyway, what is the solution for my case? I can define 2 beans, each in it > own scope. > But how can I get the "intercepted" reference of one bean in another bean? > > Regards, > Alexey > > > [EMAIL PROTECTED] wrote: > >> alsha schrieb: >> >>> Hi, >>> >>> I am using Hibernate and have 2 session factories congigured: >>> >>> 1. sessionFactory -> persistentContextFactory >>> 2. dmsSessionFactory -> dmsPersistentContextFactory >>> >>> Each one has its own interceptor >>> (persistentContextConversationInterceptor >>> and dmsPersistentContextConversationInterceptor). >>> >>> Now I configure my conversation scope as follows: >>> >>> ... >>> <entry key="conversation.manual"> >>> <bean >>> class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope"> >>> <!--<property name="timeout" value="15" /--> >>> <property name="advices"> >>> <list> >>> <ref bean="persistentContextConversationInterceptor" >>> /> >>> <ref >>> bean="dmsPersistentContextConversationInterceptor" >>> /> >>> </list> >>> </property> >>> </bean> >>> </entry> >>> ... >>> >>> But it seems, like only the first interceptor works (For example, the >>> entities from dmsSessionFactory couldn't be loaded lazyly...) >>> >>> What I am doing wrong? >>> >>> >> You're doing nothing wrong, it just isn't currently supported by >> Orchestra. >> >> Class PersistenceContextConversationInterceptor stores the current >> conversation context into a conversation attribute using key >> PERSISTENCE_CONTEXT_CONV_ATTRIBUTE. So only one persistence context per >> conversation is supported. >> >> By the way, if Orchestra did support multiple persistence contexts, then >> how would code specify which was being used with which operation (in >> particular, with the @Transactional annotation)? >> >> Regards, >> Simon >> >> >> >> > >

