How to get rid of LazyInitializationException with Wicket JPA/Hibernate integration (with Spring)
This blog post (that goes into the details of LDM) gave me some good insights especially for edit scenarios:
FWIW I had very good results using a custom RequestCycle (as suggested in the comments section of the link above) in PerfBench and you can find the code here. IIRC this is a simplification of the approach (OpenSessionInView / London Wicket) from the link Bozho posted.
I finally had time to work on that problem again. Don 't know how i could have missed the simple solution ;)
We had developed our own UIFormModel
implementation of the Wickets IModel Interface. Since i wanted to keep the user input during http requests, i did nothing in the detach() call, keeping (and serializing) the model object in full state.
All i had to add was a flag that detach() was called and check that flag in the getObject()
method. If the flag was set, i do a EntityManager.merge()
and have a reattached model that i can use in the UI components.
Thanks all for your input