Pleas fill an issue On Tue, May 22, 2012 at 5:43 PM, Dimitris Zenios <dimitris.zen...@gmail.com>wrote:
> Hi guys i think there is a bug in tapestry-jpa and value encoder > > In a discussion i was reading, Howard changed valueEncoder of > tapestry-hibernate to return null in toClient if the id of the object > was null.That was use full in cases where we wanted to have the same > page for save/edit. > > Quote from Howard > "I recently changed Tapestry 5.3 so that the Hibernate ValueEncoder > (used implicitly by @PageActivationContext) will encode a transient > entity as null. This makes it possible to use the same page for add > and edit, with a bit of smart logic in your onActivate() event handler > method. > " > > Unfortunately the same doesn't happen in Tapestry-jpa.Is this a real > bug or there should be another way to have same page for save/edit. > > To Client of tapestry-jpa > public String toClient(final E value) > { > if (value == null) > return null; > > final Object id = propertyAdapter.get(value); > > if (id == null) > throw new IllegalStateException( > String.format( > "Entity %s has an %s property of null; > this probably means that it has not been persisted yet.", > value, idPropertyName)); > > return typeCoercer.coerce(id, String.class); > } > > > To client of tapestry-hibernate > public String toClient(E value) > { > if (value == null) > return null; > > Object id = propertyAdapter.get(value); > > if (id == null) > { > return null; > } > > return typeCoercer.coerce(id, String.class); > } > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org > For additional commands, e-mail: dev-h...@tapestry.apache.org > > -- Best regards, Igor Drobiazko http://tapestry5.de http://twitter.com/drobiazko