How to keep an Hibernate's Session open until the page is rendered
Posted
by Neuquino
on Stack Overflow
See other posts from Stack Overflow
or by Neuquino
Published on 2010-06-09T13:15:34Z
Indexed on
2010/06/09
13:42 UTC
Read the original article
Hit count: 274
I'm having the following problem:
- I'm using Oracle ADF for the view and controller of my app.
- With OpenSessionInViewFilter, I intercept the request and open an Hibernate's Session, and it is closed as soon as the bean's method finishes.
What I need is to keep the Session opened until the page is rendered, because in my JSP y use the lazy attributes of the object i load from the DB.
For example:
When I enter index.jspx the IndexBean#main() is executed:
public class IndexBean{
private DBObject myDBObject;
public String main(){
this.myDBObject = this.myDAO.loadObjectFromDB();
return null;
}
}
in index.jspx I have:
...
<af:inputText value="#{myDBObject.lazyAttribute}" />
...
I'd like that the Hibernate's Session keeps open until the af:inputText is processed.
Is this possible? How?
Thanks in advance
© Stack Overflow or respective owner