Create your custom request cycle, and add a getter that uses the session's username/id to retrieve the user from the database, and cache it locally.
Martijn On 9/11/07, Anthony Schexnaildre <[EMAIL PROTECTED]> wrote: > This makes sense. Where would you stick the user on the requestcycle? > It's not obvious from the javadocs. Is there a "wicket way"? > > -Anthony > > On Sep 11, 2007, at 10:05 AM, Maurice Marrink wrote: > > > Martijn, you are absolutely right, i forgot we moved the user from the > > session to the requestcycle. Just keep the id for your user in the > > session and keep the actual user for this request in the requestcycle. > > This way each thread will have its own instance of the user. > > > > Maurice > > > > On 9/11/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote: > >> Just a quick note: storing objects that are not thread safe in your > >> session is asking for trouble. While Wicket does limit page > >> processing > >> to one request at a time, other requests like resources can run in > >> parallel. What does this mean? > >> > >> One thing that comes to mind is that when two requests for the same > >> session are being processed, and one is done before the other it will > >> detach the user model. What are the semantics now for the other > >> thread? > >> > >> For instance if you have a detachable model storing a User object in > >> your session and use Hibernate you are in a world of hurt, or rather > >> Hibernate will sometimes bork because your Session tries to attach > >> the > >> single User instance to multiple Hibernate Session objects. > >> Exceptions > >> will be having a party. > >> > >> Now this is not meant as a Hibernate bashing reply, it just happens > >> that Hibernate correctly detects multiple threads modifying the same > >> object's state and stops tampering with it. > >> > >> Martijn > >> > >> -- > >> Buy Wicket in Action: http://manning.com/dashorst > >> Apache Wicket 1.3.0-beta3 is released > >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/ > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0-beta3 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
