RE: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-12 Thread bobhedlund
_ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hazem Saleh Sent: Thursday, September 11, 2008 9:38 PM To: MyFaces Discussion Subject: Re: Implementing Hibernate Open session per view in Apache MyFaces Please send me the (Hibernate.cfg.xml) file content. Thank you. On Fri

Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Ayub Khan
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:

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Simon Kitching
Ayub Khan schrieb: 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

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Hazem Saleh
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_classthread/property. Another better idea, I got later, you can use only one PL on the

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Ayub Khan
Thank you Simon !!! I will try implementing the transactions around the listeners and check if it resolves the issue. Regards Ayub On Thu, Sep 11, 2008 at 9:35 PM, Simon Kitching [EMAIL PROTECTED]wrote: Ayub Khan schrieb: Hi, I have impleted the phaseListener using the idea presented on

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Hazem Saleh
Just a small note, I think you do not need two transactions as the SELECT operations do not transactions. If you implemented a single INVOKE_APPLICATION PL that will be enough. Thank you. On Thu, Sep 11, 2008 at 11:48 AM, Ayub Khan [EMAIL PROTECTED] wrote: Thank you Simon !!! I will try

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Hazem Saleh
I will provide the new proper way soon to the wiki as well + a working sample to make everything clear. On Thu, Sep 11, 2008 at 12:27 PM, Hazem Saleh [EMAIL PROTECTED] wrote: Just a small note, I think you do not need two transactions as the SELECT operations do not transactions. If you

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Hazem Saleh
I updated the blog entry by the single working PL. http://www.jroller.com/HazemBlog/entry/implementing_hibernate_open_session_per *Here it is:* public class OSPVFPL implements PhaseListener { public void beforePhase(PhaseEvent event) { SessionFactory sessionFactory =

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Ayub Khan
Hi Hazem, I have implemented as per your suggestion using a single PL. The PL is registered in facesConfig.xml and the hibernateconfig file has property name=current_session_context_classthread/property still I am getting org.hibernate.LazyInitializationException: could not initialize proxy

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Hazem Saleh
Please send me the (Hibernate.cfg.xml) file content. Thank you. On Fri, Sep 12, 2008 at 2:03 AM, Ayub Khan [EMAIL PROTECTED] wrote: Hi Hazem, I have implemented as per your suggestion using a single PL. The PL is registered in facesConfig.xml and the hibernateconfig file has property

Re: Implementing Hibernate Open session per view in Apache MyFaces

2008-09-11 Thread Ayub Khan
Hi Hazem, Attached is the hibernate.cfg.xml file for your reference. Thank you Regards Ayub On Fri, Sep 12, 2008 at 3:38 PM, Hazem Saleh [EMAIL PROTECTED] wrote: Please send me the (Hibernate.cfg.xml) file content. Thank you. On Fri, Sep 12, 2008 at 2:03 AM, Ayub Khan [EMAIL PROTECTED]