Has anyone found a convenient fix for this scenario:

You have a form that has fields for working on a large object. Most of
the validation is done through wicket, but there are a few complex
business rules that must be validated at the service tier. If these
rules fail an exception is thrown and spring rolls back the current
transaction (which was ultimately started by the Form and joined by the
service methods). The problem is that when spring rolls back a
transaction it clears the current hibernate session. This causes a
LazyInit exception because I have a panel that tries to load a
collection from the object during the same rendering cycle.

So far I can only think of 2 good fixes:
1) make the collection eagerly loaded
2) mark the forms transaction read-only, but mark the service method (which
persists the object) REQUIRES_NEW and then merge the object into this
new transaction if it passes extended validation.

I'm not even sure if #2 will work. Has anyone run into this?

-Ryan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to