Re: not again: hibernate OpenSessionInViewInterceptor lazyinitialization
exception
Tom Anderson wrote:
comp.lang.java.programmer wrote:
How do you set a breakpoint inside the library?
How do i do it? I use Eclipse, so i open the class, go to the Outline view,
bring up the context menu on the method i'm interested in, and select 'Toggle
method breakpoint'.
What you will have to do depends on what IDE or debugger you're using.
Your IDE will have inbuilt "help" and online documentation to lead you through
the desired functionality.
It helps a lot if you have mounted the Hibernate source with the library.
Before you go to that level of detail, try setting breakpoints on all uses of
'Session' in the relevant portions of your code. You don't always have to
step into the 3rd-party library code; it's usually enough to examine your own
code's use of it.
Just don't be surprised if the use of 'Session' that you fail to instrument
turns out to be where the problem is.
Most if not all of the 'LazyInitializationException' errors I've seen were the
result of incorrect use of 'Session', that is, in ways that contravene the
instructions. I didn't need to read Hibernate's source to see those errors;
they were pretty darned evident in the application code.
Which makes me wonder how they got there in the first place, but that's
another question.
--
Lew
Honi soit qui mal y pense.