嗨即时通讯工具与web应用程序上的jboss。我有一个类似于论坛页面的页面,您可以在其中发布消息并回复已发布的消息。在我的JSF中,我有三个div标签,一个用于添加新消息,一个用于列出所有消息,另一个用于查看选定消息。所有标签嵌入并没有对每一个标签像这样渲染属性:休眠懒加载未更新
<h:pannelGroup rendered="#{myController.shouldRender('add')}">
<!-- Here is my html for adding new message -->
</h:pannelGroup>
<h:pannelGroup rendered="#{myController.shouldRender('list')}">
<!-- Here is my html for listing messages -->
</h:pannelGroup>
<h:pannelGroup rendered="#{myController.shouldRender('view')}">
<!-- Here is my html for viewing message and its replys..
also there is hidden div with html for popup to post reply -->
<div id="reply">
<!-- This is hidden html that is shown when clicked reply
link in the message div below.
When shown users can add reply to the message -->
</div>
<div id="message">
<!-- Here is show the message itself -->
</div>
<div id="replyList">
<!-- Here is list replys for the message currently beeing viewed
For listing the replys i used ui:repeate and c:forEach from the jstl core
both resulting with same outcome.
In my message object i have list of replys which i load lazily...
-->
</div>
</h:pannelGroup>
我支持bean,全部剥离注释和代码的其余部分的...
MyController{
String page;
public boolean shouldRender(String view){
return page.equals(view);
}
}
的页面属性我设置actionListener从菜单项列表中,在我重定向用户到message.xhtml页面之前我设置myController的属性页到我想要查看的div名称,所以为例如如果我点击添加链接,我设置页面=“添加”并重定向到message.xhtml。在那里控制器从外部拿起页面集并呈现添加div。
因为我无法设法获得扩展持久化上下文的工作,所以我在/ *上设置了过滤器来打开用户事务,然后将实体管理器与该实体管理器合并,并在chain.DoFilter之后提交我的事务。这我需要手工启用延迟加载..
问题是,当我添加回复消息,回复列表不会立即刷新,我需要回到消息列表,然后再次打开相同在视图div中的消息获取刷新的答复列表..或...在添加答复的方法中,我试图手动加载我的答复消息对象拥有的答复列表(这是懒惰加载和映射@OneToMany ),这种方式,但我不喜欢这种解决方案。
有人能告诉我天气hibernate正在重新加载懒加载列表,因为我管理交易,我假设一旦它加载我的列表,它不刷新它自己。
该列表被提取一次,涉及访问列表的memebrs的第一个操作,不会被隐式更新 – kostja