Glad to see it was just a misunderstanding. I was afraid you guys were gonna tell me the world isn't flat ;)
Maurice On 7/31/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > i wasnt suggesting setting the user on request cycle, i was suggesting > keeping the id in session and letting requestcycle hold the cache for the > request. > > i didnt realize websession has attach/detach, so this can be made simpler > > MySession extends WebSession { > private long userid; > private transient User user; > > setUser(User u) { > userid=u.getid(); > user=u; > } > > getUser() { > if (user==null) { > user=loaduserbyid(userid); > } > return user; > } > > detach() { > user=null; > > } > > -Igor > > > On 7/31/06, Maurice Marrink <[EMAIL PROTECTED]> wrote: > > > store is detached. second request comes in and it is dealing with stale > data > > > unless you reload the user object. > > correct that is why you should use an imodel or come up with your own > > attach detach strategy > > > > > also storing imodel in session wont work because session doesnt have an > > > imodel slot so who is going to be responsible for detaching that model > at > > > the end of request? > > session has an onattach and ondetach method you can use. > > > > Also the way i understand how the whole requestcycle stuff happens > > (and i know you guys know way more about that then me) is that a new > > requestcycleobject is created on every request by a factory so how is > > the current user supposed to get set on the requestcycle? > > > > Don't get me wrong i am not criticizing you guys, i am just curious as > > to how the internals of wicket operate. > > > > Maurice > > > > On 7/31/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote: > > > but we are talking about caching here. if you store the instance of the > user > > > you loaded in session that is fine for the request that loaded it. but > what > > > happens after that request ends? the session is closed, the instance you > > > store is detached. second request comes in and it is dealing with stale > data > > > unless you reload the user object. > > > > > > also storing imodel in session wont work because session doesnt have an > > > imodel slot so who is going to be responsible for detaching that model > at > > > the end of request? > > > > > > -Igor > > > > > > > > > > > > On 7/31/06, Maurice Marrink <[EMAIL PROTECTED]> wrote: > > > > > > > true, but shouldn't the lock on the session prevent that in like 95% > > > of all the cases? > > > > > > Maurice > > > > > > On 7/31/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > > > > A session can be used by multiply threads/request > > > > So it will be detached by those when they are finished. > > > > So another request can be busy with it while another calls detach on > it. > > > > > > > > johan > > > > > > > > > > > > > > > > On 7/31/06, Maurice Marrink < [EMAIL PROTECTED]> wrote: > > > > > >i wouldn't recommend doing this in session because user entity will > > > > > become detached, i >would instead do it in the requestcycle so the > > > > > user is loaded once per request > > > > > Yeah are you sure about this Igor? because we are also attaching our > > > > > user object (hibernate object) to our session, lazy loading it > > > > > whenever needed. And we have not noticed it getting detached before > > > > > the end of the request. Mats i guess this also answers your question > > > > > about if it is possible to put an imodel in the session. however if > > > > > you are really concerned about the db access every time you could > > > > > always store the team id in the session. > > > > > > > > > > Maurice > > > > > > > > > > On 7/31/06, Mats Norén < [EMAIL PROTECTED] > wrote: > > > > > > On 7/31/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > > > > > > i wouldnt recommend doint this in session because user entity > will > > > > become > > > > > > > detached, i would instead do it in the requestcycle so the user > is > > > > loaded > > > > > > > once per request > > > > > > > > > > > > It is? I've used a User-object in session and I haven't noticed > that > > > > > > it gets detached.... I guess I'll have to look into to that. > > > > > > > > > > > > Can I still have a getUser() method in Session that in turn uses > the > > > > code below? > > > > > > > > > > > > I think I saw an example (could have been in databinder) where a > > > > > > IModel was stored in session. Is that an alternative? > > > > > > > > > > > > > ((MyRequestCycle)RequestCycle.get()).getUser(); > > > > > > > > > > > > > > MyRequestCycle { > > > > > > > private transient User user; > > > > > > > > > > > > > > getuser() { if (user==null) { user=loaduser( > > > > session.get().getuserid()); } > > > > > > > onendrequest() { user=null; } > > > > > > > } > > > > > > > > > > > > > > -Igor > > > > > > > > > > > > > > > > > > > /Mats > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > > > Join SourceForge.net 's Techsay panel and you'll get the chance to > > > share > > > > your > > > > > > opinions on IT & business topics through brief surveys -- and earn > > > cash > > > > > > > > > > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > > > _______________________________________________ > > > > > > Wicket-user mailing list > > > > > > Wicket-user@lists.sourceforge.net > > > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > > Join SourceForge.net's Techsay panel and you'll get the chance to > share > > > > your > > > > > opinions on IT & business topics through brief surveys -- and earn > cash > > > > > > > > > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > > _______________________________________________ > > > > > Wicket-user mailing list > > > > > Wicket-user@lists.sourceforge.net > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > Join SourceForge.net's Techsay panel and you'll get the chance to > share > > > your > > > > opinions on IT & business topics through brief surveys -- and earn > cash > > > > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > > > > > _______________________________________________ > > > > Wicket-user mailing list > > > > Wicket-user@lists.sourceforge.net > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > > opinions on IT & business topics through brief surveys -- and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > _______________________________________________ > > > Wicket-user mailing list > > > Wicket-user@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > ------------------------------------------------------------------------- > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > > opinions on IT & business topics through brief surveys -- and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > > > _______________________________________________ > > > Wicket-user mailing list > > > Wicket-user@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys -- and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user