I am using Spring MVC with OpenSessionInViewFilter and trying to find best practice to get lazy collection size on jsp (without loading collection and LazyInitializationException).
Any solutions?
Asked
Active
Viewed 620 times
0
Escander
- 256
- 3
- 19
-
It's a common issu. The solution is the Open Session Pattern http://stackoverflow.com/questions/1847040/open-session-in-view-pattern – Momo Dec 07 '12 at 20:11
1 Answers
0
Either use a dedicated HQL query that counts the elements in the collection, or use extra-lazy fetching, which can be enabled using the @LazyCollection annotation.
JB Nizet
- 678,734
- 91
- 1,224
- 1,255
-
yes, I know about `extra-lazy fetching` and it's works fine in controller but on jsp I still have `LazyInitializationException` – Escander Dec 08 '12 at 11:47
-