tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitris Zenios <dimitris.zen...@gmail.com>
Subject Re: Tapestry JPA Bug
Date Wed, 23 May 2012 17:40:36 GMT
Anyone?

On Tue, May 22, 2012 at 6:43 PM, Dimitris Zenios
<dimitris.zenios@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message