You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org> on 2009/02/05 19:53:59 UTC

[jira] Commented: (TAP5-165) Components which use PrimaryKeyEncoder should be changed to use ValueEncoder, and PrimaryKeyEncoder should be eliminated.

    [ https://issues.apache.org/jira/browse/TAP5-165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12670860#action_12670860 ] 

Howard M. Lewis Ship commented on TAP5-165:
-------------------------------------------

The PrimarykeyEncoder *could* be deprecated and eliminated. The Loop component could fire an event to inform its container that it should preload a set of keys.

But I still don't like it, because it forces on the application the work of changing the String that the Loop component knows about back into an id (say, a Long) that can be used to pre-load.

Here's an idea ... if we ditch the pre-loading concept entirely (it can be rolled into its own Hibernate-specific component) .. we can simplify Loop AND address this issue.

I would suggest that we keep the encoder parameter of Loop (for at least one release) and emit a warning if it is used.  We should then add new parameter (of type ValueEncoder).

Alternately, perhaps we can provide a TypeCoercion from PKE to ValueEncoder; then we can have compatibility. Under the new system, a default ValueEncoder could be derived from the value parameters' type.

The only disadvantage of this is that a String version of an entity id is bulkier than a wrapped primitive (a Long). However, GZIP compression should take care of that reasonably.

> Components which use PrimaryKeyEncoder should be changed to use ValueEncoder, and PrimaryKeyEncoder should be eliminated.
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-165
>                 URL: https://issues.apache.org/jira/browse/TAP5-165
>             Project: Tapestry 5
>          Issue Type: Improvement
>    Affects Versions: 5.0.16
>         Environment: any
>            Reporter: Robert Zeigler
>            Priority: Minor
>
> While working on an application, I noticed that my objects were being serialized "weird" into a form by the loop component.  I realized that I hadn't provided the primary key encoder, and once I did things worked as expected.  That got me to thinking that it would be nice if the Loop component, and other components that rely on PrimaryKeyEncoders, could check to see if there is an encoder available for the value-type, if none is explicitly bound by the user.  That way, module-authors could provide PrimaryKeyEncoders that makes things work "like magic". 
> For example, tapestry-hibernate could contribute PrimaryKeyEncoders for each entity type so that the objects are automatically, and properly, encoded into forms.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.