如何在Weld中检索所有现有的长期运行的对话? [英] How to retrieve all existing long-running conversations in Weld?

查看:102
本文介绍了如何在Weld中检索所有现有的长期运行的对话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用JBoss 7.1.1.Final,Weld,Seam 3编写应用程序.我有以下bean:

I'm writing application in JBoss 7.1.1.Final, Weld, Seam 3. I have following bean:

@ConversationScoped
public class ConversationBean implements Serializable {

   @Inject
   Conversation conversation;

   private Article article;
...
}

现在,用户可能会创建多个对话,每个对话将与ConversationBean实例相关联.我需要能够获取与长时间运行的对话相关联的所有实例.

Now, the user might create multiple conversations, each conversation will be associated with the instance of ConversationBean. I need to be able to get all those instances that are associated with long-running conversation.

我需要访问它们的原因是,如果用户多次打开一篇文章(因此他将与同一篇文章创建多个对话).如果他在一次对话中更改了文章,我希望能够在其他对话中刷新文章.

The reason why I need an access to them is that if a user opens one Article multiple times (thus he will create multiple conversations with the same article). If he changes the Article in one conversation, I want to be able to refresh the Articles in the other conversations.

有一些标准的方法可以做到这一点吗?

Is there some standard way to do this?

文章"实例由entityManager查找,并在会话中进行管理.使用Seam托管持久性上下文检索实体管理器.

"article" instance is looked up by entityManager and is managed within conversation. Entity manager is retrieved using Seam Managed Persistence Context.

推荐答案

每个会话仅进行一次对话.注入对话将为您提供一个长期运行的对话(如果尚未提升,则为临时对话).

Per session there's only ever one conversation going on. Injection Conversation will give you the one long-running conversation (or temporary conversation if it hasn't been promoted) going on).

这篇关于如何在Weld中检索所有现有的长期运行的对话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆