Re: Building object through wizard.
Hi Thiago, when making updates to an existing object, at the start of the wizard I'm initially populating it with a criteria query, then on submit to page2 from page1, I populate the SessionState and rebuild my object in page 2 with the SessionState rather than the criteria query. I'm assuming that this is the correct way to do it. However I've ran into issues where hibernates lazing loading feature doesn't eagerly grab empty collections which causes an exception when page 2's object has been populated from the session object and try's to load a collection. I was able to fix this by getting the collection size prior to persisting the object in page 1 to the session state. Seems like a bit of a hack to me. Thanks Guys. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Building-object-through-wizard-tp5713417p5713422.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Building object through wizard.
Thanks Guys, for your input. All very helpful. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Building-object-through-wizard-tp5713417p5713420.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Building object through wizard.
On Fri, 25 May 2012 11:02:42 -0300, George Christman wrote: miserably with that. "Maybe I'm missing something". So my question is therea alternative solution such as SessionState or Persist where I could store the object in memory and then later save? Why not SessionState? Unless you need the same user using the same wizard for editing two different objects in two different threads, there's no reason to avoid it. When the wizard is finished, send the object to the database and set the @SessionState field to null (so it isn't stored in the session anymore when it ceases to be used). -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Building object through wizard.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi George, using some sort of conversation (i.e. HTTP session) state is one way to go - you would either detach the entities or use some sort of specialized Transfer Objects. Another way to go is to put the wizard into a single Tapestry page and use Ajax to switch between the different 'pages' of the wizard. For very complex pages, the effort may be prohibitive, but you can remain free of session state this way. You can store state of 'previous' steps of the wizard in hidden fields, or you can just 'hide' currently unused steps using CSS. Validation (both client and server side) can be tricky though because you do *not* want to validate data for steps that have not even been reached yet. Using @Persist, i.e. storing stuff in the HTTP session, gets your code up and working pretty fast. If your users open the same page in two browser tabs at the same time however you run into sticky issues. Removing data from the session in all situations when the user finishes, aborts or just leaves the wizard can also be tricky (there are other subtly problematic situations like concurrent requests). Avoiding session state takes more effort to develop initially because you need to address storage, lifetime etc. of temporary data explicitly. In my experience, it makes for more robust applications in the long run. There are situations for both approaches - take your pick ;-) Am 25.05.2012 16:25, schrieb Chris Cureau: > Hi George! > > What I am doing for this is following the Jumpstart example...I > store all of my entities in the Conversation, and on the last page > of the Wizard I write them to the database. It's worked out very > well so far. Check out > http://jumpstart.doublenegative.com.au/jumpstart/examples/wizard/usingpages1 > > for > the example I am using. > > There's also a page there for different techniques for passing data > between pages...check > http://jumpstart.doublenegative.com.au/jumpstart/examples/state/passingdatabetweenpages > > > > Another big thanks to Geoff for providing this valuable resource! > > On Fri, May 25, 2012 at 9:02 AM, George Christman > wrote: > >> Hello, I'm building a small little wizard that consist of a few >> pages. The wizard allows for updates as well. I'm a hibernate >> user with a fairly complex data structure consisting of many >> joined entities. I do not want to save/update the data until the >> last page of the wizard which has caused me to lose my data from >> one page to the next. I thought there was a way to persist it >> with hibernate and retrieve it on the next page, but I've failed >> miserably with that. "Maybe I'm missing something". So my >> question is there a alternative solution such as SessionState or >> Persist where I could store the object in memory and then later >> save? >> >> -- View this message in context: >> http://tapestry.1045711.n5.nabble.com/Building-object-through-wizard-tp5713417.html >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> - >> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+/m40ACgkQbmZsMyUPuXSSoQCg6X+LmZvf3K6AErSX9oeY7HvN 8mEAoNyouBjtXL0hz5FTrJteHWK7721P =r7A4 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Building object through wizard.
Hi George! What I am doing for this is following the Jumpstart example...I store all of my entities in the Conversation, and on the last page of the Wizard I write them to the database. It's worked out very well so far. Check out http://jumpstart.doublenegative.com.au/jumpstart/examples/wizard/usingpages1 for the example I am using. There's also a page there for different techniques for passing data between pages...check http://jumpstart.doublenegative.com.au/jumpstart/examples/state/passingdatabetweenpages Another big thanks to Geoff for providing this valuable resource! On Fri, May 25, 2012 at 9:02 AM, George Christman wrote: > Hello, I'm building a small little wizard that consist of a few pages. The > wizard allows for updates as well. I'm a hibernate user with a fairly > complex data structure consisting of many joined entities. I do not want to > save/update the data until the last page of the wizard which has caused me > to lose my data from one page to the next. I thought there was a way to > persist it with hibernate and retrieve it on the next page, but I've failed > miserably with that. "Maybe I'm missing something". So my question is there > a alternative solution such as SessionState or Persist where I could store > the object in memory and then later save? > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Building-object-through-wizard-tp5713417.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Building object through wizard.
Hello, I'm building a small little wizard that consist of a few pages. The wizard allows for updates as well. I'm a hibernate user with a fairly complex data structure consisting of many joined entities. I do not want to save/update the data until the last page of the wizard which has caused me to lose my data from one page to the next. I thought there was a way to persist it with hibernate and retrieve it on the next page, but I've failed miserably with that. "Maybe I'm missing something". So my question is there a alternative solution such as SessionState or Persist where I could store the object in memory and then later save? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Building-object-through-wizard-tp5713417.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org