It's not my app, I'm just doing some consulting, and the author prefers this approach. He isn't using much BeanEditForm either. Also, that would not help with the primary situation described below ... he has a @PageActivationContext field that stores either a transient or a persistent Hibernate entity.
On Tue, Sep 6, 2011 at 12:54 AM, Ulrich Stärk <[email protected]> wrote: > Why don't you let beaneditform handle the creation of new entities? I'm doing > this all over my apps > and never had a problem with tapestry-hibernate's ValueEncoder getting into > my way... > > Uli > > On 02.09.2011 01:55, Howard Lewis Ship wrote: >> I'm helping a client build a CRUD app on top of tapestry-hibernate >> >> His pattern is to use the same exact page for edit and create pages >> >> The problem he's getting is this: >> >> @PageActivationContext >> private MyEntity myEntity; >> >> void onActivate() { if (myEntity == null) { myEntity = new MyEntity(); } } >> >> This works fine for editing of existing entities, but the creation >> fails ... tapestry-hibernate's ValueEncoder attempts to encode the >> transient instance and gets a failure because there's no persistent id >> until it is made persistent. >> >> I'd like to change the support to handle this case by returning a null >> or empty page activation context when the object to be encoded is null >> or transient. >> >> This is a quasi-backwards-compatible change ... it will enable a >> behavior that, in prior releases, would be a runtime exception. >> >> Thoughts? >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
