Hi,

I ran into a small problem when using hibernate inside a flowscript and
a velocity template to generate the XML from the "hibernated" objects.
Here's what I'm doing:

1. Get a hibernate session and retrieve some objects from the DB.
2. Pass these objects to a velocity generator to create some XML (I'm
calling cocoon.sendPage()).
3. Close the hibernate session.

Now, when I serialize the velocity output to XML, there's no problem; if
I add a XSL transform step and serialize to HTML, I get lazy
initialization exceptions. 

So it seems that sendPage doesn't always wait for the page to be
generated.

I fixed this issue by specifying the FetchMode to hibernate (so there's
no lazy behaviour anymore), but I'd like to know if there's a preferred
way of dealing with such problems: when can I safely close the hibernate
session ? (I think it would be nice to keep the Collection
initialization lazy)

I looked at (and stole from) the
http://wiki.cocoondev.org/Wiki.jsp?page=XMLFormJXFormHibernateAndFlowscr
ipt page, but I don't see when the session is closed (when is
UserRegistry.release() called ?).

Thanks for any idea or code sample,

Nicolas.


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

Reply via email to