0

Hibernate LazyInitializationException with Spring in ZK

asked 2008-07-10 12:21:47 +0800

gw1234 gravatar image gw1234
63 1

Hi,

I read the smalltalk Hibernate + ZK.

If I understand it right, the Spring based OpenSessionInViewFilter does not function because ZK triggers multiple requests for a page. I receive the LazyInitializationException while creating a simple window.

You have a paralell solution that works without Spring. Is there a way to use org.zkoss.zkplus.hibernate.OpenSessionInViewListener based on a Spring context?

My configuration is similar to those in this thread.

What would be the best practice in this case?

Thanks,

Gabor

delete flag offensive retag edit

6 Replies

Sort by » oldest newest
link publish delete flag offensive edit

answered 2008-07-11 12:44:57 +0800

gw1234 gravatar image gw1234
63 1

thanks. now it works.

Gabor

link publish delete flag offensive edit

answered 2009-01-26 17:28:12 +0800

jrdalpra gravatar image jrdalpra
6

Please, I´m trying to do a "Lazy" call with Hibernate + Spring and I´m getting LazyInitializatonExceptio. I´ve done all configurations in zk.xml (ThreadLocalListenter), web.xml (Spring OpenSessionInViewFilter), but I´m still getting this Exception. Can you help me? Thanks.

link publish delete flag offensive edit

answered 2009-01-27 11:31:07 +0800

jrdalpra gravatar image jrdalpra
6

Problem solved. If you try to get some lazy collection, you need to reload your bean from your ORM tool (Hibernate) before get the lazy collection. Don´t forget to configure your OpenSessionInView Filter and syncronize your threads. Thanks.

link publish delete flag offensive edit

answered 2009-04-03 13:51:19 +0800

daddymaze gravatar image daddymaze
3

Hello. Am having a similar and very funny and boring problem. Its taking me days to solve it.

Am using openSessionInViewFilter and it seems to be workin when i access a specific zul page, typing its url directly in
the browser(the hibernate session is found open and I am able to load the lazy collections).
But when i call the same page as an inner page from an INCLUDE component (the app url doesnt change, only the src of the include component
does), i find the session closed and i get the famous exception: COllection is not associated with any session :-).
Since the main page which contains the include component was already loaded, the hibernate session is supposed to
be closed (thats how i tried to interpret this error).

Is there anyway to force the session to open when using the include component?

Thanks and Mayday!

link publish delete flag offensive edit

answered 2009-04-06 02:27:52 +0800

robbiecheng gravatar image robbiecheng
1144 2
http://robbiecheng.sys-co...

please follow jrdalpra's suggestion to reload the bean from ORM tool again in your included page.
or the session would be closed in last request.

/robbie

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-07-10 12:21:47 +0800

Seen: 693 times

Last updated: Apr 06 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More