Best practice for dynamically storing state?
Hi All, I have an application with a widget sidebar, with all the normal capabilities (add/remove widgets for user, minimize, maximize, sort widgets, etc.). I just wanted to ask what the best practice for storing the state of these widgets to a DB is. The current implementation involves using an Ajax call every time the state is changed (complete with a Loading indicator), so that the state is saved to the DB. This seems a bit heavy to me though, and doesn't seem that responsive (as the user has to wait every time the state is changed). The other option I was thinking of is to just save the state in the Session, and persist upon logout. Would there be any problems with this approach (memory-heavy)? Or are there other alternatives? I prefer to have the user change state (sort, expand/collapse, etc.) anytime they like, which is why I didn't go for the lock/unlock widgets approach (where you have to manually save your widget state). If it makes a difference, I'm using wiQuery. Thanks for any help! Regards, Ces
Re: What about an onInitialRender method ?
Small fixes in the javadoc: 1) Add this point in time shouldn't that be At this point in time ? 2) all parents must be have been added to their parents = I would remove the be Maarten On Fri, Apr 2, 2010 at 11:09 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: from Component.java in 1.5 (trunk) /** * Callback method invoked after the component was added to its parent AND you can walk up the * hierarchy up until the Page. That is, all parents must be have been added to their parents as * well. Add this point in time {...@link #getMarkup() getMarkup} is guaranteed to be available. * p * This method is guaranteed to called only once * /p * p * If you don't like constructors to initialize your component, this is the method to use. * /p */ protected void onInitialize() { } -igor On Fri, Apr 2, 2010 at 2:03 PM, Joseph Pachod josephpac...@thomas-daily.de wrote: hi The other day, I was busy creating reusable components. To make them safe, I used what I believe is a wicket good practices: adding the components in onBeforeRender. In fact, it's not just in onBeforeRender, it's rather : @Override protected void onBeforeRender() { if(!hasBeenRendered()){ // actual code } super.onBeforeRender(); } having done this stuff repeatedly, I felt a bit annoyed but these many if(!hasBeenRendered()) and the brackets/indentations it brings. Furthermore, on the few occasions I really needed something done on each onBeforeRender, it brought clutter to the code. Last but not least, recently, I was helping a wicket beginner and explaining this onBeforeRender/if(!hasBeenRendered) wasn't the best moment I had. As such, I started to wonder if a simple onInitialRender method (or similarly named) could be created ? It would run once and only once before the first onBeforeRender. onBeforeRender would then return to what it should really mean (but still have this handy hasBeenRendered() method just in case). In the end, it's trivial but would save a few keystrokes and bring some clarity. What do you think of that ? thanks in advance joseph - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket and JEE6
On Wed, Mar 31, 2010 at 5:05 AM, Iskandar Salim locrianm...@gmail.comwrote: Olivier Bourgeois-2 wrote: ... everything is simple unmanaged POJOs except for your classes extending WebPage which are managed Not to be picky but a minor correction :) everything is simple unmanaged POJOs except for your classes extending [Component] which are managed I wonder what the use would be for the request, session, and conversation scopes in wicket since these are already managed expiicitly in wicket. At least, I wouldn't see a great need for such scopemanagement by the container. It would be nice however if CDI could be used to inject EJBs, resources, and OSGI services into pages. -- View this message in context: http://old.nabble.com/Wicket-and-JEE6-tp28045129p28091022.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Best Practices for Using JavaScript With Wicket
Hi, I am working on an application that's very rich in UI. Most of the input validation, unless it requires back-end support, are done at UI level. There are drag-and-drop, multiple file uploader (not the one in wicket extensions), and customized warning message (much like Stack-overflow's top info-panel that slides-in the page) and Tiny-MCE etc. I am finding it very cumbersome to integrate JavaScript/JS-library. Can someone point to (or probably write a blog-post on :-) the best practices of integrating JS/JS-library with Wicket. I am using JQuery but I would like to know the best approach without using WiQuery or jWicket. (Unless, I have to write my own jWicket to get this done.) Thanks Nishant
Re: Wicket form data isn't received
Hello, I left this for a week - but had another look. It's weird - if I don't mess with the flow (ie don;t try to do NTLM authentication) it works fine. However, I somehow seem to be messing up the process flow with the NTLM authentication. Unfortunately I'm not currently running through an ide so I'm relying on debug statements. don't know if it will shed any light, but what I'm seeing is; Make request to /app (redirects to login page which includes login panel) In LoginPage - constructor, username password null In LoginPanel constructor In LoginPanel.onBeforeRender Call ntlm authorization throw AbortWithHttpStatusException In LoginPage - constructor, username password null In LoginPanel constructor In LoginPanel.onBeforeRender At this point, have an authentication header, but no user information. In LoginPage - constructor, username password null In LoginPanel constructor In LoginPanel.onBeforeRender Obtain and validate ntlm authentication Call AuthenticatedWebSession.get().signIn with windows username throw unknown user exception catch exception, call error Page displayed to user - fill in form, hit submit In LoginPanel.onBeforeRender (no constructor called) user is empty string (not value entered or null) At this point I get the entry below, so it seems that the submit isnot getting called and also that the user and passwod values are not being submitted from the form to the class. 05 Apr 2010 09:55:24,798: time=25,event=Interface[target:NrgLoginPanel$OmsLoginForm(nrgLoginPanel:loginForm), page: com.sam.auth.NrgLoginPage(2), interface: IFormSubmitListener.onFormSubmitted],response=Interface[target:NrgLoginPanel$OmsLoginForm(nrgLoginPanel:loginForm), page: com.sam.auth.NrgLoginPage(2), interface: IFormSubmitListener.onFormSubmitted],sessionid=564654FE9A6195261CB9895783FCDD45,sessionsize=6970,sessionstart=Mon Apr 05 09:55:13 EDT 2010,requests=6,totaltime=2612,activerequests=0,maxmem=891M,total=531M,used=261M On Fri, Mar 26, 2010 at 5:14 PM, Josh Chappelle jchappe...@4redi.comwrote: Bryan, Have you put a breakpoint in your onSubmit method of the form to see if it is getting to that point? If it isn't then make sure you don't have a validator failing and no feedback panel. I've made that mistake before. Thanks, Josh -Original Message- From: Bryan Montgomery [mailto:mo...@english.net] Sent: Friday, March 26, 2010 3:33 PM To: users@wicket.apache.org Subject: Wicket form data isn't received I've been working on an existing wicket application and am banging my head against the desk :) I'm trying to have two different pages that handle the sign on for the authenticated web session. One which is using ntlm with jcifs works fine. However, I can't get any other forms to work. I see from looking closely at the log file that the data is posted - however it almost looks like it's redirected. I did see that it was 'unable to find cookie' - but i wouldn't think that is the problem. I've looked through the web.xml and the page we have that extends the AuthenticatedWebApplication. I'm not sure if that is the issue, or if it something else. I wonder if the form is being redirected as it is not authenticated ending up in a catch 22. Is a way to have unauthenticated pages when using the AuthenticatedWebApplication? Or am I stuck in a vicious circle :) I've included the html and java, based on the article at http://www.developer.com/java/web/article.php/3673576/Wicket-The-First-Steps .htmhttp://www.developer.com/java/web/article.php/3673576/Wicket-The-First-Steps%0A.htm 26 Mar 2010 13:42:13,430: (request cycle) url: /nrg/app/test 26 Mar 2010 13:42:13,603: Add userId to [MarkupContainer [Component id = loginForm]] 26 Mar 2010 13:42:13,605: Add loginForm to [Page class = com.sam.auth.TestLogin, id = 0, version = 0] 26 Mar 2010 13:42:13,649: Begin render [Page class = com.sam.auth.TestLogin, id = 0, version = 0] 26 Mar 2010 13:42:13,657: Load markup: cacheKey=com.sam.auth.TestLoginen_UShtml 26 Mar 2010 13:42:13,694: Loading markup from file:/home/HOMEDIRS/montgomeryb/tomcat/webapps/nrg/WEB-INF/classes/com/sam/a uth/TestLogin.html 26 Mar 2010 13:42:13,756: ending request for page [Page class = com.sam.auth.TestLogin, id = 0, version = 0], request [method = GET, protocol = HTTP/1.1, requestURL = http://poe3b:8800/nrg/app/test, contentType = null, contentLength = -1, contextPath = /nrg, pathInfo = null, requestURI = /nrg/app/test, servletPath = /app/test, pathTranslated = null] 26 Mar 2010 13:42:13,771: time=328,event=BookmarkablePage[com.sam.auth.TestLogin()],response=Bookmarka blePage[com.sam.auth.TestLogin()],sessionid=535C7A65C8E2F12DE0EEA8EF26830D80 ,sessionsize=326,sessionstart=Fri Mar 26 13:42:13 EDT 2010,requests=2,totaltime=328,activerequests=0,maxmem=891M,total=525M,used=2 45M 26 Mar 2010 13:42:13,771: ending request for page [Page class = com.sam.auth.TestLogin, id = 0, version = 0], request [method = GET, protocol =
Re: Any mature work on integrating Hibernate Validator with Wicket?
Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any mature work on integrating Hibernate Validator with Wicket?
David Chang schrieb: Any comment or pointers regarding relatively mature work in this regard? we did something that does not need spring, though it need some polishing and is not yet released. i´ll contact you later this week. cu uwe - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any mature work on integrating Hibernate Validator with Wicket?
you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any mature work on integrating Hibernate Validator with Wicket?
thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any mature work on integrating Hibernate Validator with Wicket?
Do you have any user stories on the topic? It would be useful to evaluate how interesting the use case is. Me myself I cannot immagine anything useful could come out of hibernate validators, only something very trivial. Could be wrong, thoug. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any mature work on integrating Hibernate Validator with Wicket?
so if somebody took the code from the blogs and put them on a project in wicketstuff that would make it more mature? there is not much to integrating the validators with wicket so each project probably built out their own way to do it that suits that project. -igor On Mon, Apr 5, 2010 at 8:27 AM, David Chang david_q_zh...@yahoo.com wrote: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
saving datetextfield values on ajax refresh
here's the scenario, i have a datetextfield that when the page gets updated via ajax, the datatextfield values get reset and are no longer what they changed to. i've tried adding an onchange behavior to the datefield to update the modelobject when the field is changed but have had no luck. anyone else had this problem? can you maybe give me a code snippet to work with? thanks mail2web.com Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: saving datetextfield values on ajax refresh
What initiates ajax-updating the page? What do you update? Few solutions: a) use listview.setreuseitems b) use a formcomponentreusemanager c) use an AjaxFormSubmittingChangeListenerBehavior ** Martin 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: here's the scenario, i have a datetextfield that when the page gets updated via ajax, the datatextfield values get reset and are no longer what they changed to. i've tried adding an onchange behavior to the datefield to update the modelobject when the field is changed but have had no luck. anyone else had this problem? can you maybe give me a code snippet to work with? thanks mail2web.com – Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any mature work on integrating Hibernate Validator with Wicket?
Using Hibernate Validator may bring a few good things: 1. On the data end, it helps to improve data, performance, etc. Also the annotation you write on domain objects get translated into database creation and objects save/update. You can find more on in this area. Obviously, this has nothing to do with wicket. 2. Regarding the web tier, it is often needed to write validation rules such as not null or the maximum chars in an input field being less than 10. In pure wicket, you have to add many validation rules yourself manually for each field. Why should I do so second time in wicket if I can explicitly specify them on domain objects via Hibernate Validator (or Bean Validation, JSR 303, now official)? I hope to see wicket can take adavantage of bean validation to let us code faster and have more maintainable code. Please feel free to comment I am wrong. Best. --- On Mon, 4/5/10, Martin Makundi martin.maku...@koodaripalvelut.com wrote: From: Martin Makundi martin.maku...@koodaripalvelut.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:31 AM Do you have any user stories on the topic? It would be useful to evaluate how interesting the use case is. Me myself I cannot immagine anything useful could come out of hibernate validators, only something very trivial. Could be wrong, thoug. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe,
Re: Any mature work on integrating Hibernate Validator with Wicket?
so if somebody took the code from the blogs and put them on a project in wicketstuff that would make it more mature? I dont think so. wicketstuff is just one place to look at. But I dont think people would put their blogs there. Yes, they can. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:35 AM so if somebody took the code from the blogs and put them on a project in wicketstuff that would make it more mature? there is not much to integrating the validators with wicket so each project probably built out their own way to do it that suits that project. -igor On Mon, Apr 5, 2010 at 8:27 AM, David Chang david_q_zh...@yahoo.com wrote: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket GAE performance
Hello Tony, Anton Veretennikov wrote: This is a transaction of every session? I believe that there is some pooling of at least one of PersistenceManager[s] (PM[s]) and Transaction[s] (TX[s]). Nevertheless, the code extract I provided will yield a PM and TX unique to the thread (and therefore the request too in GAE/J) running that code. Your PM and TX will not leak to another request. I believe that the PersistenceManagerFactory (PMF) ensures this (if I am wrong, will someone please correct me). Anton Veretennikov wrote: If no, how may i handle this situation: When one user is accessing a page i must return data from one entity from the datastore, then close it from returning to any other users. What can be done here? Do you ask here How do I ensure that a user cannot see data 'belonging' to another user? Of course, your code will controls what data you exchange with the GAE datastore, so if it already ensures that some persistent entities are to be accessed by a specific user only, then this should continue. A different user calling your persistence code will have a different PM and TX; your user-specific data exchange should continue to be user-specific. Just ensure that the PMF is global to your Wicket application instance (a singleton only is required), and that your data exchange code gets, uses and closes PMs (using this PMF instance) as and when needed. As for transactions, the combination of what data exchange you perform, your JDO settings, and the GAE/J and DataNucleus documentation will determine whether you need to use a transaction. If I have not addressed your question Tony, would you please be so kind as to re-phrase it? Regards, Ian -- View this message in context: http://old.nabble.com/Wicket-GAE-performance-tp28118591p28141583.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any mature work on integrating Hibernate Validator with Wicket?
Hi! It's quite easy to add trivial min/max/required validators using (any) helper method. Maybe bindgen project would be closest to this.. it's already working with annotations, it could perhaps parse also annotations of property target objects. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: Using Hibernate Validator may bring a few good things: 1. On the data end, it helps to improve data, performance, etc. Also the annotation you write on domain objects get translated into database creation and objects save/update. You can find more on in this area. Obviously, this has nothing to do with wicket. 2. Regarding the web tier, it is often needed to write validation rules such as not null or the maximum chars in an input field being less than 10. In pure wicket, you have to add many validation rules yourself manually for each field. Why should I do so second time in wicket if I can explicitly specify them on domain objects via Hibernate Validator (or Bean Validation, JSR 303, now official)? I hope to see wicket can take adavantage of bean validation to let us code faster and have more maintainable code. Please feel free to comment I am wrong. Best. --- On Mon, 4/5/10, Martin Makundi martin.maku...@koodaripalvelut.com wrote: From: Martin Makundi martin.maku...@koodaripalvelut.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:31 AM Do you have any user stories on the topic? It would be useful to evaluate how interesting the use case is. Me myself I cannot immagine anything useful could come out of hibernate validators, only something very trivial. Could be wrong, thoug. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail:
Re: saving datetextfield values on ajax refresh
along with the datetextfield i have a dropdownchoice menu. the page updates based on the item selected in the dropdown which updates a list menu. Original Message: - From: Martin Makundi martin.maku...@koodaripalvelut.com Date: Mon, 5 Apr 2010 18:40:15 +0300 To: users@wicket.apache.org Subject: Re: saving datetextfield values on ajax refresh What initiates ajax-updating the page? What do you update? Few solutions: a) use listview.setreuseitems b) use a formcomponentreusemanager c) use an AjaxFormSubmittingChangeListenerBehavior ** Martin 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: here's the scenario, i have a datetextfield that when the page gets updated via ajax, the datatextfield values get reset and are no longer what they changed to. i've tried adding an onchange behavior to the datefield to update the modelobject when the field is changed but have had no luck. anyone else had this problem? can you maybe give me a code snippet to work with? thanks mail2web.com Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mail2web.com Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: saving datetextfield values on ajax refresh
In that case you need this: http://mail-archives.apache.org/mod_mbox/wicket-users/201001.mbox/%3c303141551001032147u239d89d7w26bf26b814296...@mail.gmail.com%3e 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: along with the datetextfield i have a dropdownchoice menu. the page updates based on the item selected in the dropdown which updates a list menu. Original Message: - From: Martin Makundi martin.maku...@koodaripalvelut.com Date: Mon, 5 Apr 2010 18:40:15 +0300 To: users@wicket.apache.org Subject: Re: saving datetextfield values on ajax refresh What initiates ajax-updating the page? What do you update? Few solutions: a) use listview.setreuseitems b) use a formcomponentreusemanager c) use an AjaxFormSubmittingChangeListenerBehavior ** Martin 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: here's the scenario, i have a datetextfield that when the page gets updated via ajax, the datatextfield values get reset and are no longer what they changed to. i've tried adding an onchange behavior to the datefield to update the modelobject when the field is changed but have had no luck. anyone else had this problem? can you maybe give me a code snippet to work with? thanks mail2web.com – Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mail2web.com – Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: saving datetextfield values on ajax refresh
My issue is not with a dropdownchoice itself, the dropdown functionality works fine. its when i repaint the panel, the textfield loses its changed values and reverts to the default model. Original Message: - From: Martin Makundi martin.maku...@koodaripalvelut.com Date: Mon, 5 Apr 2010 20:08:27 +0300 To: users@wicket.apache.org Subject: Re: saving datetextfield values on ajax refresh In that case you need this: http://mail-archives.apache.org/mod_mbox/wicket-users/201001.mbox/%3C3031415 51001032147u239d89d7w26bf26b814296...@mail.gmail.com%3e 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: along with the datetextfield i have a dropdownchoice menu. the page updates based on the item selected in the dropdown which updates a list menu. Original Message: - From: Martin Makundi martin.maku...@koodaripalvelut.com Date: Mon, 5 Apr 2010 18:40:15 +0300 To: users@wicket.apache.org Subject: Re: saving datetextfield values on ajax refresh What initiates ajax-updating the page? What do you update? Few solutions: a) use listview.setreuseitems b) use a formcomponentreusemanager c) use an AjaxFormSubmittingChangeListenerBehavior ** Martin 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: here's the scenario, i have a datetextfield that when the page gets updated via ajax, the datatextfield values get reset and are no longer what they changed to. i've tried adding an onchange behavior to the datefield to update the modelobject when the field is changed but have had no luck. anyone else had this problem? can you maybe give me a code snippet to work with? thanks mail2web.com Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mail2web.com Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mail2web - Check your email from the web at http://link.mail2web.com/mail2web - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: saving datetextfield values on ajax refresh
Yes, that will fix it. ** Martin 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: My issue is not with a dropdownchoice itself, the dropdown functionality works fine. its when i repaint the panel, the textfield loses its changed values and reverts to the default model. Original Message: - From: Martin Makundi martin.maku...@koodaripalvelut.com Date: Mon, 5 Apr 2010 20:08:27 +0300 To: users@wicket.apache.org Subject: Re: saving datetextfield values on ajax refresh In that case you need this: http://mail-archives.apache.org/mod_mbox/wicket-users/201001.mbox/%3C3031415 51001032147u239d89d7w26bf26b814296...@mail.gmail.com%3e 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: along with the datetextfield i have a dropdownchoice menu. the page updates based on the item selected in the dropdown which updates a list menu. Original Message: - From: Martin Makundi martin.maku...@koodaripalvelut.com Date: Mon, 5 Apr 2010 18:40:15 +0300 To: users@wicket.apache.org Subject: Re: saving datetextfield values on ajax refresh What initiates ajax-updating the page? What do you update? Few solutions: a) use listview.setreuseitems b) use a formcomponentreusemanager c) use an AjaxFormSubmittingChangeListenerBehavior ** Martin 2010/4/5 wic...@geofflancaster.com wic...@geofflancaster.com: here's the scenario, i have a datetextfield that when the page gets updated via ajax, the datatextfield values get reset and are no longer what they changed to. i've tried adding an onchange behavior to the datefield to update the modelobject when the field is changed but have had no luck. anyone else had this problem? can you maybe give me a code snippet to work with? thanks mail2web.com – Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mail2web.com – Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mail2web - Check your email from the web at http://link.mail2web.com/mail2web - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
LoadableDetachable Models
I am having issues with LDM, Hibernate lazy loaded lists, and ajax. I create a CompoundPropertyModel of a LDM and set that as the default model for the page. I then pass the model to the form and to a custom component in the form. The custom component is a list editor. Basically a ListView with lots of ajax link for editing the values. The issue I am having is I can get everything to work however because of the LDM, the model is being over-written on each Ajax request and also on form submission so I cannot modify any values since they are not available in the onsubmit because the LDM reloads. If I do not use the LDM then I get Hibernate errors because of the lazy loading. If I remove the lazy loading and use eager loading and don't use the LDM then everything works fine. The issue is because of the eager loading then other parts of the application load lots of data that is not needed. Any ideas? Can I not use the LDM for what I want? Thanks.
Re: Any mature work on integrating Hibernate Validator with Wicket?
So far this is what I've got. Doesn't do anything with groups or the more advanced stuff but this may be all it takes. public class BeanComponentValidatorT extends AbstractValidatorT { public BeanComponentValidator() { super(); } @Override protected void onValidate(IValidatableT validatable) { for(ConstraintViolationT violation : validate(validatable.getValue())) { validatable.error(new ValidationError().addMessageKey(violation.getMessage())); } } SetConstraintViolationT validate(T value) { Validator validator = Validation.buildDefaultValidatorFactory().getValidator();//this may only be working because I'm using Spring 3.0.2 and Hibernate 3.5 I don't know for sure. return validator.validate(value); } } On Mon, Apr 5, 2010 at 12:15 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Hi! It's quite easy to add trivial min/max/required validators using (any) helper method. Maybe bindgen project would be closest to this.. it's already working with annotations, it could perhaps parse also annotations of property target objects. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: Using Hibernate Validator may bring a few good things: 1. On the data end, it helps to improve data, performance, etc. Also the annotation you write on domain objects get translated into database creation and objects save/update. You can find more on in this area. Obviously, this has nothing to do with wicket. 2. Regarding the web tier, it is often needed to write validation rules such as not null or the maximum chars in an input field being less than 10. In pure wicket, you have to add many validation rules yourself manually for each field. Why should I do so second time in wicket if I can explicitly specify them on domain objects via Hibernate Validator (or Bean Validation, JSR 303, now official)? I hope to see wicket can take adavantage of bean validation to let us code faster and have more maintainable code. Please feel free to comment I am wrong. Best. --- On Mon, 4/5/10, Martin Makundi martin.maku...@koodaripalvelut.com wrote: From: Martin Makundi martin.maku...@koodaripalvelut.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:31 AM Do you have any user stories on the topic? It would be useful to evaluate how interesting the use case is. Me myself I cannot immagine anything useful could come out of hibernate validators, only something very trivial. Could be wrong, thoug. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Sunday, April 4, 2010, 11:31 PM Found another related work. http://42lines.net/content/integrating-hibernate-validator-and-wicket Any comment or pointers regarding relatively mature work in this regard? Regards. --- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Saturday, April 3, 2010, 1:45 PM Is there any mature work on integrating Hibernate Validator with Wicket? I am unable to find any at wicketstuff. Googled and found this work is interesting. http://carinae.net/tag/hibernate-validator/ Any pointers? Any comment? Thanks and Happy Easter!
Re: Wicket and JEE6
I wonder what the use would be for the request, session, and conversation scopes in wicket since these are already managed expiicitly in wicket. At least, I wouldn't see a great need for such scopemanagement by the container. It would be nice however if CDI could be used to inject EJBs, resources, and OSGI services into pages. Sorry for the mail bombing but just got @EJB injection to work based on the weld-wicket integration. With this setup the only thing I am missing is probably the long-lived convesations support, but that is not essential for me. Essential is the link to ejbs and container resources and the converged container support in Java EE6 which will simplify a lot. The main trick is to register only the component instantiation listener from weld-wicket in the application class. class WicketApplication extends WebApplication { private NonContextualWeldComponentInstantiationListener weldComponentInstantiationListener; /** * Constructor */ public WicketApplication() { // Empty. } @Override protected void init() { BeanManager mgr = BeanManagerLookup.getBeanManager(); System.out.println(BeanManager ' + mgr + '); this.weldComponentInstantiationListener = new NonContextualWeldComponentInstantiationListener(BeanManagerLookup.getBeanManager(), WeldComponentInstantiationListener.class); addComponentInstantiationListener(weldComponentInstantiationListener.newInstance().produce().inject().get()); } ... } Next is simply the use of @EJB in a regular page object. This works without having to patch the application server.
Re: Wicket and JEE6
Did you not look at what I put together? I've already got all the injection stuff (and conversations) working and I've got example applications illustrating it. On Mon, Apr 5, 2010 at 3:47 PM, Erik Brakkee erik.brak...@gmail.com wrote: I wonder what the use would be for the request, session, and conversation scopes in wicket since these are already managed expiicitly in wicket. At least, I wouldn't see a great need for such scopemanagement by the container. It would be nice however if CDI could be used to inject EJBs, resources, and OSGI services into pages. Sorry for the mail bombing but just got @EJB injection to work based on the weld-wicket integration. With this setup the only thing I am missing is probably the long-lived convesations support, but that is not essential for me. Essential is the link to ejbs and container resources and the converged container support in Java EE6 which will simplify a lot. The main trick is to register only the component instantiation listener from weld-wicket in the application class. class WicketApplication extends WebApplication { private NonContextualWeldComponentInstantiationListener weldComponentInstantiationListener; /** * Constructor */ public WicketApplication() { // Empty. } �...@override protected void init() { BeanManager mgr = BeanManagerLookup.getBeanManager(); System.out.println(BeanManager ' + mgr + '); this.weldComponentInstantiationListener = new NonContextualWeldComponentInstantiationListener(BeanManagerLookup.getBeanManager(), WeldComponentInstantiationListener.class); addComponentInstantiationListener(weldComponentInstantiationListener.newInstance().produce().inject().get()); } ... } Next is simply the use of @EJB in a regular page object. This works without having to patch the application server. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket and JEE6
On Mon, Apr 5, 2010 at 9:54 PM, James Carman jcar...@carmanconsulting.comwrote: Did you not look at what I put together? I've already got all the injection stuff (and conversations) working and I've got example applications illustrating it. I tried to look at it but couldn't access the subversion repo because of timeouts. Atter looking at the code of weld-wicket and seeing that it was just a small amount of code, it was relatively easy to figure out what is was doing and disable the long-lived conversations support. The URL I am trying is: http://svn.carmanconsulting.com/public/wicket-cdi/trunk Can you make sure the URL is working again? I will then have a look at it. The aim would be for an implementation that is completely independent of weld, i.e. does not use any weld core classes and only uses standard CDI APIs and wicket APIs. (to avoid the problem of having to patch the application server).
Re: Wicket and JEE6
It's apparently down again. That's what I get for hosting my server at my in-law's house. Cheaper isn't necessarily better. If you want, I can email you the code. On Mon, Apr 5, 2010 at 4:32 PM, Erik Brakkee erik.brak...@gmail.com wrote: On Mon, Apr 5, 2010 at 9:54 PM, James Carman jcar...@carmanconsulting.comwrote: Did you not look at what I put together? I've already got all the injection stuff (and conversations) working and I've got example applications illustrating it. I tried to look at it but couldn't access the subversion repo because of timeouts. Atter looking at the code of weld-wicket and seeing that it was just a small amount of code, it was relatively easy to figure out what is was doing and disable the long-lived conversations support. The URL I am trying is: http://svn.carmanconsulting.com/public/wicket-cdi/trunk Can you make sure the URL is working again? I will then have a look at it. The aim would be for an implementation that is completely independent of weld, i.e. does not use any weld core classes and only uses standard CDI APIs and wicket APIs. (to avoid the problem of having to patch the application server). - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Any mature work on integrating Hibernate Validator with Wicket?
Hi David, I'm the author of the first article that you linked to: http://carinae.net/tag/hibernate-validator/ http://carinae.net/2009/12/integration-of-jsr-303-bean-validation-standard-and-wicket-1-4/Basically, you hardly need more than the two provided validators (for property validation on field input, and full bean validation on form input). I added some extra code to integrate it with Spring and to centralize the locale, but if you don't need it, you can easily use only those validators without anything else. The way I see it, there is no code in wicketstuff because it is quite simple to integrate jsr303 and wicket, so picking the code from my or others blog, and maybe tweaking it a little for your needs is probably all you need. On Mon, Apr 5, 2010 at 9:39 PM, Ben Tilford bentilf...@gmail.com wrote: So far this is what I've got. Doesn't do anything with groups or the more advanced stuff but this may be all it takes. public class BeanComponentValidatorT extends AbstractValidatorT { public BeanComponentValidator() { super(); } @Override protected void onValidate(IValidatableT validatable) { for(ConstraintViolationT violation : validate(validatable.getValue())) { validatable.error(new ValidationError().addMessageKey(violation.getMessage())); } } SetConstraintViolationT validate(T value) { Validator validator = Validation.buildDefaultValidatorFactory().getValidator();//this may only be working because I'm using Spring 3.0.2 and Hibernate 3.5 I don't know for sure. return validator.validate(value); } } On Mon, Apr 5, 2010 at 12:15 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Hi! It's quite easy to add trivial min/max/required validators using (any) helper method. Maybe bindgen project would be closest to this.. it's already working with annotations, it could perhaps parse also annotations of property target objects. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: Using Hibernate Validator may bring a few good things: 1. On the data end, it helps to improve data, performance, etc. Also the annotation you write on domain objects get translated into database creation and objects save/update. You can find more on in this area. Obviously, this has nothing to do with wicket. 2. Regarding the web tier, it is often needed to write validation rules such as not null or the maximum chars in an input field being less than 10. In pure wicket, you have to add many validation rules yourself manually for each field. Why should I do so second time in wicket if I can explicitly specify them on domain objects via Hibernate Validator (or Bean Validation, JSR 303, now official)? I hope to see wicket can take adavantage of bean validation to let us code faster and have more maintainable code. Please feel free to comment I am wrong. Best. --- On Mon, 4/5/10, Martin Makundi martin.maku...@koodaripalvelut.com wrote: From: Martin Makundi martin.maku...@koodaripalvelut.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:31 AM Do you have any user stories on the topic? It would be useful to evaluate how interesting the use case is. Me myself I cannot immagine anything useful could come out of hibernate validators, only something very trivial. Could be wrong, thoug. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To:
Re: Any mature work on integrating Hibernate Validator with Wicket?
Ben, Thanks for sharing your code, which, IMHO, definately helps not only me but also others. I believe that using Hibernate Validator really kills more than one bird in one stone. All the best, David P.S. folks, please feel free to comment how you feel about the Bean Validation/Hiberate Validator thing. Just wanted to do the right/good thing for me and everybody. There might be cases where using Hibernate Validator will not be helpful or bad. Please feel free to let us know if you can think of them. --- On Mon, 4/5/10, Ben Tilford bentilf...@gmail.com wrote: From: Ben Tilford bentilf...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 3:39 PM So far this is what I've got. Doesn't do anything with groups or the more advanced stuff but this may be all it takes. public class BeanComponentValidatorT extends AbstractValidatorT { public BeanComponentValidator() { super(); } @Override protected void onValidate(IValidatableT validatable) { for(ConstraintViolationT violation : validate(validatable.getValue())) { validatable.error(new ValidationError().addMessageKey(violation.getMessage())); } } SetConstraintViolationT validate(T value) { Validator validator = Validation.buildDefaultValidatorFactory().getValidator();//this may only be working because I'm using Spring 3.0.2 and Hibernate 3.5 I don't know for sure. return validator.validate(value); } } On Mon, Apr 5, 2010 at 12:15 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Hi! It's quite easy to add trivial min/max/required validators using (any) helper method. Maybe bindgen project would be closest to this.. it's already working with annotations, it could perhaps parse also annotations of property target objects. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: Using Hibernate Validator may bring a few good things: 1. On the data end, it helps to improve data, performance, etc. Also the annotation you write on domain objects get translated into database creation and objects save/update. You can find more on in this area. Obviously, this has nothing to do with wicket. 2. Regarding the web tier, it is often needed to write validation rules such as not null or the maximum chars in an input field being less than 10. In pure wicket, you have to add many validation rules yourself manually for each field. Why should I do so second time in wicket if I can explicitly specify them on domain objects via Hibernate Validator (or Bean Validation, JSR 303, now official)? I hope to see wicket can take adavantage of bean validation to let us code faster and have more maintainable code. Please feel free to comment I am wrong. Best. --- On Mon, 4/5/10, Martin Makundi martin.maku...@koodaripalvelut.com wrote: From: Martin Makundi martin.maku...@koodaripalvelut.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:31 AM Do you have any user stories on the topic? It would be useful to evaluate how interesting the use case is. Me myself I cannot immagine anything useful could come out of hibernate validators, only something very trivial. Could be wrong, thoug. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:21 AM you have answered your own question twice, why does anyone else need to reply? -igor On Mon, Apr 5, 2010 at 8:01 AM, David Chang david_q_zh...@yahoo.com wrote: Hi folks, I feel a bit puzzled about not getting any response on this topic. I have to say that I am new in Wicket. If this a bad or wrong question or if this is something not worthy to explore, please feel free to let me know. Thanks for any input! --- On Sun, 4/4/10, David Chang david_q_zh...@yahoo.com wrote: From: David Chang david_q_zh...@yahoo.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To:
Re: Any mature work on integrating Hibernate Validator with Wicket?
Carlos, Thanks for chiming in and for good work and sharing! so picking the code from my or others blog, The code may be simple, but the idea/benefits I see may be great. Wouldn't be better to make it available on wicketstuff in good shape instead of me or others googling it out? :) Just my 2 cents. Regards, David --- On Mon, 4/5/10, Carlos Vara bashfl...@gmail.com wrote: From: Carlos Vara bashfl...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 4:52 PM Hi David, I'm the author of the first article that you linked to: http://carinae.net/tag/hibernate-validator/ http://carinae.net/2009/12/integration-of-jsr-303-bean-validation-standard-and-wicket-1-4/Basically, you hardly need more than the two provided validators (for property validation on field input, and full bean validation on form input). I added some extra code to integrate it with Spring and to centralize the locale, but if you don't need it, you can easily use only those validators without anything else. The way I see it, there is no code in wicketstuff because it is quite simple to integrate jsr303 and wicket, so picking the code from my or others blog, and maybe tweaking it a little for your needs is probably all you need. On Mon, Apr 5, 2010 at 9:39 PM, Ben Tilford bentilf...@gmail.com wrote: So far this is what I've got. Doesn't do anything with groups or the more advanced stuff but this may be all it takes. public class BeanComponentValidatorT extends AbstractValidatorT { public BeanComponentValidator() { super(); } @Override protected void onValidate(IValidatableT validatable) { for(ConstraintViolationT violation : validate(validatable.getValue())) { validatable.error(new ValidationError().addMessageKey(violation.getMessage())); } } SetConstraintViolationT validate(T value) { Validator validator = Validation.buildDefaultValidatorFactory().getValidator();//this may only be working because I'm using Spring 3.0.2 and Hibernate 3.5 I don't know for sure. return validator.validate(value); } } On Mon, Apr 5, 2010 at 12:15 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Hi! It's quite easy to add trivial min/max/required validators using (any) helper method. Maybe bindgen project would be closest to this.. it's already working with annotations, it could perhaps parse also annotations of property target objects. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: Using Hibernate Validator may bring a few good things: 1. On the data end, it helps to improve data, performance, etc. Also the annotation you write on domain objects get translated into database creation and objects save/update. You can find more on in this area. Obviously, this has nothing to do with wicket. 2. Regarding the web tier, it is often needed to write validation rules such as not null or the maximum chars in an input field being less than 10. In pure wicket, you have to add many validation rules yourself manually for each field. Why should I do so second time in wicket if I can explicitly specify them on domain objects via Hibernate Validator (or Bean Validation, JSR 303, now official)? I hope to see wicket can take adavantage of bean validation to let us code faster and have more maintainable code. Please feel free to comment I am wrong. Best. --- On Mon, 4/5/10, Martin Makundi martin.maku...@koodaripalvelut.com wrote: From: Martin Makundi martin.maku...@koodaripalvelut.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5, 2010, 11:31 AM Do you have any user stories on the topic? It would be useful to evaluate how interesting the use case is. Me myself I cannot immagine anything useful could come out of hibernate validators, only something very trivial. Could be wrong, thoug. ** Martin 2010/4/5 David Chang david_q_zh...@yahoo.com: thanks for chiming in. sorry if i was not clear in prevoius posts. i would like to hear comments whether it is worthy to explore or any benefits. i also would like to know whether there is more mature work since i only found experimental work. i am unable to find anything aobut it on wicketstuff. regards. --- On Mon, 4/5/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: Any mature work on integrating Hibernate Validator with Wicket? To: users@wicket.apache.org Date: Monday, April 5,
Re: Wicket and JEE6
On Mon, Apr 5, 2010 at 10:37 PM, James Carman jcar...@carmanconsulting.comwrote: It's apparently down again. That's what I get for hosting my server at my in-law's house. Cheaper isn't necessarily better. If you want, I can email you the code. You can mail the code to me. If it's not too much code, you can also mail it to the list I guess. I think in general, the code should become part of a wicket-cdi project just like wicket-spring and wicket-guice already are. I think the wicket community is probably a better place to maintain this then the weld project. This is because the code could use internal wicket APIs which are more prone to change than the CDI APIs which is a standard. So we would catch problems in the implementation much earlier. It feels a bit like stealing but I am in any case really grateful for the work done by the weld project. This is surely going to save a lot of people some time because standard Java EE capabilities can be used in wicket.
Re: Wicket and JEE6
On Mon, Apr 5, 2010 at 5:27 PM, Erik Brakkee erik.brak...@gmail.com wrote: I think in general, the code should become part of a wicket-cdi project just like wicket-spring and wicket-guice already are. I think the wicket community is probably a better place to maintain this then the weld project. This is because the code could use internal wicket APIs which are more prone to change than the CDI APIs which is a standard. So we would catch problems in the implementation much earlier. It feels a bit like stealing but I am in any case really grateful for the work done by the weld project. This is surely going to save a lot of people some time because standard Java EE capabilities can be used in wicket. What I'll do is set it up in wicketstuff. That way others can contribute/maintain it too. I've got permission already, so I can put it up there sometime this evening. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: LoadableDetachable Models
Jeffrey, The problem is that if you use an LDM, the list is loaded from persistent storage, and any non-persisted changes from the previous request are lost. If you don't use an LDM, though, you will have stale objects hanging around from the previous Hibernate session (as you mentioned). Think in the mindset that persistent Hibernate objects are only valid within the context of a request. Only transient objects are safe to hold references to. You can implement a custom model which keeps track of transient items between requests. It can extend LDM. For example: -Custom LDM loads the list from persistent storage -User clicks a button to add an object to the list -myCustomModel.addObject(newObject) is called by your ajax behavior (triggered by the click) -The list is modified, and your model internally stores a list of transient objects which were added or removed -On the next request, your implementation of load() can get the persistent list from the database, and modify it according to the un-persisted changes the model knows about (make a copy of the list and add or remove the transient items). If you don't like putting a method like addObject(...) on your model, you could put some logic in your setObject(...) method which sorts out the changes made to the list. You should not hold a reference to a persistent object after detach(). A tool like JProbe or jvisualvm (in JDK6) is great for identifying problem cases. If you have a component who depends on the data from another component with unsaved changes, you can submit data for the prerequisite in the same request, so that the information is current. HTH, RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com] Sent: Monday, April 05, 2010 3:26 PM To: users@wicket.apache.org Subject: LoadableDetachable Models I am having issues with LDM, Hibernate lazy loaded lists, and ajax. I create a CompoundPropertyModel of a LDM and set that as the default model for the page. I then pass the model to the form and to a custom component in the form. The custom component is a list editor. Basically a ListView with lots of ajax link for editing the values. The issue I am having is I can get everything to work however because of the LDM, the model is being over-written on each Ajax request and also on form submission so I cannot modify any values since they are not available in the onsubmit because the LDM reloads. If I do not use the LDM then I get Hibernate errors because of the lazy loading. If I remove the lazy loading and use eager loading and don't use the LDM then everything works fine. The issue is because of the eager loading then other parts of the application load lots of data that is not needed. Any ideas? Can I not use the LDM for what I want? Thanks. This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind MSE to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Best Practices for Using JavaScript With Wicket
I am finding it very cumbersome to integrate JavaScript/JS-library. Can someone point to (or probably write a blog-post on :-) the best practices of integrating JS/JS-library with Wicket. Wicket is pretty flexible in that you can integrate your JS a dozen different ways. jQuery is especially easy to integrate with because the programming model matches Wicket's fairly nicely. The primary thing is that if you want to use element IDs to tie in to jQuery, you'll need to do this from behaviors in your java code so that you get the correct ID. I am using JQuery but I would like to know the best approach without using WiQuery or jWicket. (Unless, I have to write my own jWicket to get this done.) I'm not sure I understand. wiQuery has been fairly well recognized as a very nice Wicket/jQuery integration. It has active development and a helpful mailing list. So, what's the objection to using it? I'm not saying that you can't have an objection, I just wonder what it is. It's an open source project, so you can use it as a base and add your own functionality as needed (hopefully contributing back). Even if you don't want to use it, you can see some of the things they are doing with it - it has some very nice features, including mergin all the JS header contributions into a common (single) resource file. -- Jeremy Thomerson http://www.wickettraining.com
Re: LoadableDetachable Models
You can use what we call a shadow model or a proxy model. https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java This approach will work for you. Basically, you use the ProxyModelManager to wrap all of your real models (you have to explicitly create models to use this and can't use CompoundPropertyModel). Then, when you're done with what you're doing, you commit your changes into the real models. On Mon, Apr 5, 2010 at 6:11 PM, Russell Morrisey russell.morri...@missionse.com wrote: Jeffrey, The problem is that if you use an LDM, the list is loaded from persistent storage, and any non-persisted changes from the previous request are lost. If you don't use an LDM, though, you will have stale objects hanging around from the previous Hibernate session (as you mentioned). Think in the mindset that persistent Hibernate objects are only valid within the context of a request. Only transient objects are safe to hold references to. You can implement a custom model which keeps track of transient items between requests. It can extend LDM. For example: -Custom LDM loads the list from persistent storage -User clicks a button to add an object to the list -myCustomModel.addObject(newObject) is called by your ajax behavior (triggered by the click) -The list is modified, and your model internally stores a list of transient objects which were added or removed -On the next request, your implementation of load() can get the persistent list from the database, and modify it according to the un-persisted changes the model knows about (make a copy of the list and add or remove the transient items). If you don't like putting a method like addObject(...) on your model, you could put some logic in your setObject(...) method which sorts out the changes made to the list. You should not hold a reference to a persistent object after detach(). A tool like JProbe or jvisualvm (in JDK6) is great for identifying problem cases. If you have a component who depends on the data from another component with unsaved changes, you can submit data for the prerequisite in the same request, so that the information is current. HTH, RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com] Sent: Monday, April 05, 2010 3:26 PM To: users@wicket.apache.org Subject: LoadableDetachable Models I am having issues with LDM, Hibernate lazy loaded lists, and ajax. I create a CompoundPropertyModel of a LDM and set that as the default model for the page. I then pass the model to the form and to a custom component in the form. The custom component is a list editor. Basically a ListView with lots of ajax link for editing the values. The issue I am having is I can get everything to work however because of the LDM, the model is being over-written on each Ajax request and also on form submission so I cannot modify any values since they are not available in the onsubmit because the LDM reloads. If I do not use the LDM then I get Hibernate errors because of the lazy loading. If I remove the lazy loading and use eager loading and don't use the LDM then everything works fine. The issue is because of the eager loading then other parts of the application load lots of data that is not needed. Any ideas? Can I not use the LDM for what I want? Thanks. This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind MSE to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: LoadableDetachable Models
This approach stores a hard reference to the object. It seems prone to causing LazyInitializationExceptions when used with Hibernate. You are storing a reference to a persistent object (in this case, the regular Model object of the ProxyModel), so if you close your session at the end of the request, I would expect you to get this exception on the next request when you call a method on a lazy proxy object (ex: ((MyObject)model.getObject()).getLazyProperty().getName()). Do you have some other code to work around it? (like loading a fresh object from the session at the beginning of the request) It may be you don't hit this problem in your use case. RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: James Carman [mailto:jcar...@carmanconsulting.com] Sent: Monday, April 05, 2010 9:05 PM To: users@wicket.apache.org Subject: Re: LoadableDetachable Models You can use what we call a shadow model or a proxy model. https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java This approach will work for you. Basically, you use the ProxyModelManager to wrap all of your real models (you have to explicitly create models to use this and can't use CompoundPropertyModel). Then, when you're done with what you're doing, you commit your changes into the real models. On Mon, Apr 5, 2010 at 6:11 PM, Russell Morrisey russell.morri...@missionse.com wrote: Jeffrey, The problem is that if you use an LDM, the list is loaded from persistent storage, and any non-persisted changes from the previous request are lost. If you don't use an LDM, though, you will have stale objects hanging around from the previous Hibernate session (as you mentioned). Think in the mindset that persistent Hibernate objects are only valid within the context of a request. Only transient objects are safe to hold references to. You can implement a custom model which keeps track of transient items between requests. It can extend LDM. For example: -Custom LDM loads the list from persistent storage -User clicks a button to add an object to the list -myCustomModel.addObject(newObject) is called by your ajax behavior (triggered by the click) -The list is modified, and your model internally stores a list of transient objects which were added or removed -On the next request, your implementation of load() can get the persistent list from the database, and modify it according to the un-persisted changes the model knows about (make a copy of the list and add or remove the transient items). If you don't like putting a method like addObject(...) on your model, you could put some logic in your setObject(...) method which sorts out the changes made to the list. You should not hold a reference to a persistent object after detach(). A tool like JProbe or jvisualvm (in JDK6) is great for identifying problem cases. If you have a component who depends on the data from another component with unsaved changes, you can submit data for the prerequisite in the same request, so that the information is current. HTH, RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com] Sent: Monday, April 05, 2010 3:26 PM To: users@wicket.apache.org Subject: LoadableDetachable Models I am having issues with LDM, Hibernate lazy loaded lists, and ajax. I create a CompoundPropertyModel of a LDM and set that as the default model for the page. I then pass the model to the form and to a custom component in the form. The custom component is a list editor. Basically a ListView with lots of ajax link for editing the values. The issue I am having is I can get everything to work however because of the LDM, the model is being over-written on each Ajax request and also on form submission so I cannot modify any values since they are not available in the onsubmit because the LDM reloads. If I do not use the LDM then I get Hibernate errors because of the lazy loading. If I remove the lazy loading and use eager loading and don't use the LDM then everything works fine. The issue is because of the eager loading then other parts of the application load lots of data that is not needed. Any ideas? Can I not use the LDM for what I want? Thanks. This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind MSE to any order or other contract unless pursuant to explicit written agreement or
Re: LoadableDetachable Models
It doesn't hold onto the persistent object. Here's an example usage: IModelPerson personModel = ...; // Some LDM here! ProxyModelManager mgr = new ProxyModelManager(); add(new TextFieldString(firstName, mgr.proxy(new PropertyModel(personModel, firstName; Then, later on in the onSubmit() method, you'd call mgr.commit(). It's not going to hold onto the object that's loaded from the LDM. It would hold onto the property values of the object that's loaded from the LDM, but that's okay. On Mon, Apr 5, 2010 at 9:23 PM, Russell Morrisey russell.morri...@missionse.com wrote: This approach stores a hard reference to the object. It seems prone to causing LazyInitializationExceptions when used with Hibernate. You are storing a reference to a persistent object (in this case, the regular Model object of the ProxyModel), so if you close your session at the end of the request, I would expect you to get this exception on the next request when you call a method on a lazy proxy object (ex: ((MyObject)model.getObject()).getLazyProperty().getName()). Do you have some other code to work around it? (like loading a fresh object from the session at the beginning of the request) It may be you don't hit this problem in your use case. RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: James Carman [mailto:jcar...@carmanconsulting.com] Sent: Monday, April 05, 2010 9:05 PM To: users@wicket.apache.org Subject: Re: LoadableDetachable Models You can use what we call a shadow model or a proxy model. https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java This approach will work for you. Basically, you use the ProxyModelManager to wrap all of your real models (you have to explicitly create models to use this and can't use CompoundPropertyModel). Then, when you're done with what you're doing, you commit your changes into the real models. On Mon, Apr 5, 2010 at 6:11 PM, Russell Morrisey russell.morri...@missionse.com wrote: Jeffrey, The problem is that if you use an LDM, the list is loaded from persistent storage, and any non-persisted changes from the previous request are lost. If you don't use an LDM, though, you will have stale objects hanging around from the previous Hibernate session (as you mentioned). Think in the mindset that persistent Hibernate objects are only valid within the context of a request. Only transient objects are safe to hold references to. You can implement a custom model which keeps track of transient items between requests. It can extend LDM. For example: -Custom LDM loads the list from persistent storage -User clicks a button to add an object to the list -myCustomModel.addObject(newObject) is called by your ajax behavior (triggered by the click) -The list is modified, and your model internally stores a list of transient objects which were added or removed -On the next request, your implementation of load() can get the persistent list from the database, and modify it according to the un-persisted changes the model knows about (make a copy of the list and add or remove the transient items). If you don't like putting a method like addObject(...) on your model, you could put some logic in your setObject(...) method which sorts out the changes made to the list. You should not hold a reference to a persistent object after detach(). A tool like JProbe or jvisualvm (in JDK6) is great for identifying problem cases. If you have a component who depends on the data from another component with unsaved changes, you can submit data for the prerequisite in the same request, so that the information is current. HTH, RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com] Sent: Monday, April 05, 2010 3:26 PM To: users@wicket.apache.org Subject: LoadableDetachable Models I am having issues with LDM, Hibernate lazy loaded lists, and ajax. I create a CompoundPropertyModel of a LDM and set that as the default model for the page. I then pass the model to the form and to a custom component in the form. The custom component is a list editor. Basically a ListView with lots of ajax link for editing the values. The issue I am having is I can get everything to work however because of the LDM, the model is being over-written on each Ajax request and also on form submission so I cannot modify any values since they are not available in the onsubmit because the LDM reloads. If I do not use the LDM then I get Hibernate errors because of the lazy loading.