You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Dimitris Zenios <di...@gmail.com> on 2012/05/22 17:43:02 UTC
Tapestry JPA Bug
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
Re: Tapestry JPA Bug
Posted by Dimitris Zenios <di...@gmail.com>.
Anyone?
On Tue, May 22, 2012 at 6:43 PM, Dimitris Zenios
<di...@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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry JPA Bug
Posted by Dimitris Zenios <di...@gmail.com>.
Anyone?
On Tue, May 22, 2012 at 6:43 PM, Dimitris Zenios
<di...@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
Re: Tapestry JPA Bug
Posted by Dimitris Zenios <di...@gmail.com>.
https://issues.apache.org/jira/browse/TAP5-1938
Done
On Thu, May 24, 2012 at 4:28 PM, Igor Drobiazko
<ig...@gmail.com> wrote:
> Pleas fill an issue
>
> On Tue, May 22, 2012 at 5:43 PM, Dimitris Zenios
> <di...@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
>>
>>
>
>
> --
> Best regards,
>
> Igor Drobiazko
> http://tapestry5.de
> http://twitter.com/drobiazko
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
Re: Tapestry JPA Bug
Posted by Igor Drobiazko <ig...@gmail.com>.
Pleas fill an issue
On Tue, May 22, 2012 at 5:43 PM, Dimitris Zenios
<di...@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
>
>
--
Best regards,
Igor Drobiazko
http://tapestry5.de
http://twitter.com/drobiazko