See the wicket iolite maven archetype, are it setup like that?
David Hendrix wrote:
Hi,
we're using a custom WebRequestCycle in our application to handle our
Hibernate session. In onBeginRequest() the session is opened and closes
in onEndRequest(). This works just fine when using Tomcat but fails with
WicketTester.
WicketTester is constructed using our application and the target
directory to use the custom made classes, which is fine for most of our
components except when using hibernate objects to populate ListViews.
Logfiles indicate that onEndRequest() is called before populateItems()
is run, so any use of an uninitialized hibernate proxy inside a ListView
causes an Hibernate Exception
(org.hibernate.LazyInitializationException: could not initialize proxy -
no Session) and result in a failed test.
A quickstart showing the failure is hard to cough up since it would
involve an oracle database (I didn't had the time to check any other
databases), but here's an excerpt from the logfile:
2008-07-17 15:25:33,783 DEBUG [main] com.dr.e5: adding startup
configuration to session
--> This is onBeginRequest() opening the sessions
2008-07-17 15:25:33,939 INFO [main] com.dr.e5: committing hibernate
session: dev
--> This is onEndRequest() committing the sessions
2008-07-17 15:25:33,955 DEBUG [main] com.dr.e5: adding startup
configuration to session
--> This is onbeginRequest opening another set of sessions
2008-07-17 15:25:34,002 ERROR [main]
org.hibernate.LazyInitializationException: could not initialize proxy -
no Session
--> and this is finally hibernate failing to load from a proxy formerly
attached tot he first set of sessions...
Why is onEndRequest() called that early and why is onBeginRequest()
called twice?
Is there any way around this except checking and possibly reattaching
every proxy just for testing since it works just fine in 'real life'?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]