I've just started using Wicket (I'm half way through Wicket in Action). I've run into the following problem with a user registration form: In order to make sure that the provided e-mail is not already registered I've written a "UniqueEmailValidator" which I attach to the email field. This validator needs access to the DB-service to query the database for already registered email-adresses.
The problem is that the DB-service is injected when the registration page is created and since I'm using open-session-in-view, the DB-service EntityManager is closed after the page is rendered. This causes an IllegalStateException: EntityManager is closed once the form is submitted in a subsequent request. (Since the same old DB-service object is used in the second request.) (I had the same problem when trying to inject the DB-service in the session-object. The same DB-service object was used in multiple requests causing the IllegalStateException.) I figured this must be a fairly common problem but can't for my life find any solutions in the archives or through googling. I'm curious what the best practice is to solve this. (My project builds upon the code available here: http://github.com/javadev/wicket-guice-demo ) best regards, Andreas Lundblad --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
