Actually, when putting all the Hibernate stuff into java you would write some kind of wrapper class to handle all the transactions, so that there would be no need to have the session as a global variable.
To be sincere, I think you do not need it anyway ... I was just to lazy to
pass "hs" as an argument to the helper functions all the time, and lots
of times I use the session across different flowscript function. This is where
"hs" as a global variable comes in handy. However, there is no need to
keep the session open longer than your request lives, IMHO that would
be problematic when you have too many concurrent connections. I have
also written apps that do not keep "hs" global, but declare it locally when
it's needed.
Regarding Spring, I simply did not know about it when I wrote the tutorial. It was just the way I learned to use Hibernate, and I found it quite hard to find some documentation at that time. I still think it is OK to use it for minor applications (say <10 classes), although I consider it bad practice now to use it for something more serious. There should be a "CocoonHibernateAndSpringTutorial" to make this more clear.
Brent Johnson schrieb:
I've gone through the tutorial on the Wiki and everything seems to be going fine. Here's one question I have for people who have used this tutorial as a basis for implementing Hibernate with Cocoon:
Is there a good way to open the hibernate session in Java rather than in Flowscript as the tutorial suggests? For example, how would I handle the "hs" global variable, and saving the Hibernate session in the user session?
Thanks,
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
