0

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?

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 Answers1

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