You could use servlet filters to have the hibernate session open until the 
request is processed. There are articles in the www.hibernate.org that explains 
different patterns to handle situations similar to yours... Hibernate session 
needs to be open in order for the objects to load the collections or any lazy 
properties... Also, if the object is dettached then you need to re-attach it to 
the current session for it to be loaded or used... Hope this helps...

- Srini


>>> [EMAIL PROTECTED] 2/10/2006 11:22 AM >>>
    I´m using Struts 1.2.8 with Hibernate 3.0.5 and I´m doubt with some concept 
designs for ORM with MVC:

    A Hibernate session get's instantiated in my DAO constructor (Model). Later 
on, the JSP (View) catches the Hibernate persisted objects populated in the 
request or session by the Controller and shows the data.

    Question is:

    If I close Hibernate session in the Model, before the View, as by default 
the objects are lazy-instantiated, that is, the data would be retrieved from DB 
when it´s accessed, the JSP complains that session is closed.

    Besides, closing the session after the View I would be breaking the MVC 
pattern.

    I'm trying to retrieve Blob objects not sucessfully, due the problem 
above... the only way would be disable lazy-instantiation??


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to