Hi Ayub, I tried this code before and it worked fine. You should check your hibernate configuration, and make sure that: 1. You are registered your PLs. 2. <property name="current_session_context_class">thread</property>.
Another better idea, I got later, you can use only one PL on the (INVOKE_APPLICATION) phase to implement the OSPVP. Thank you. On Thu, Sep 11, 2008 at 11:22 AM, Ayub Khan <[EMAIL PROTECTED]> wrote: > Hi, > I have impleted the phaseListener using the idea presented on > http://www.jroller.com/HazemBlog/entry/implementing_hibernate_open_session_per > > I am getting "org.hibernate.HibernateException: createQuery is not valid > without active transaction" error message. > > Below is the code of phase listeners: > > public class RestoreViewPhaseListener implements PhaseListener { > > public void afterPhase(PhaseEvent event) { > } > > public void beforePhase(PhaseEvent event) { > SessionFactory sessionFactory = > > HibernateUtil.getSessionFactory(); > sessionFactory.getCurrentSession().beginTransaction(); > > > } > > public PhaseId getPhaseId() { > return PhaseId.RESTORE_VIEW; > } > > } > > Please let me where to open and close session and transaction. > > Thanks > Ayub > > > > -- > -- "Two roads diverged in a wood > And I took the one less traveled by > And that has made all the difference. > > Robert Frost....." > -- Hazem Ahmed Saleh Ahmed Web blog: http://www.jroller.com/page/HazemBlog [Web 2.0] GMaps Integration with JSF + Apache Tomahawk + JBoss a4j: http://code.google.com/p/gmaps4jsf/

