tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristian Marinkovic (JIRA)" <...@tapestry.apache.org>
Subject [jira] Commented: (TAPESTRY-2254) ValueEncoders created by HibernateEntityValueEncoder produces exceptions on empty clientValue
Date Sat, 15 Mar 2008 22:10:30 GMT

    [ https://issues.apache.org/jira/browse/TAPESTRY-2254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579091#action_12579091

Kristian Marinkovic commented on TAPESTRY-2254:

this issue was partly solved by https://issues.apache.org/jira/browse/TAPESTRY-2260

> ValueEncoders created by HibernateEntityValueEncoder produces exceptions on empty clientValue
> ---------------------------------------------------------------------------------------------
>                 Key: TAPESTRY-2254
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2254
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.0.12
>            Reporter: Kristian Marinkovic
>            Priority: Critical
> the toValue() method of the ValueEncoder created by the HibernateEntityValueEncoder service
tries coercing the clientValue to the primary key field type even if it is empty. this creates
a coercion exception. 
> 	public E toValue(String clientValue) {
> 		Class<?> idType = _idGetter.getReturnType();
> 		// cannot coerce if clientValue is empty 
> 		Object id = _typeCoercer.coerce(clientValue, idType);
> 		Serializable ser = Defense.cast(id, Serializable.class, "id");
> 		return (E)_session.get(_entityClass, ser);
> 	}
> the created ValueEncoder should return null if the client Value is empty/null
> this situation arises when a select component is submitted with the blank option selected
(see blankOption parameter of select component). as long as there is no required validator
associated with the select box null is a valid value (a list of entities is used for the SelectModel).

> furthermore there is no way to override/decorate the HibernateEntityValueEncoder nor
to exclude certain entities from having ValueEncoders created. this is useful when custom
ValueEncoders are provided. in existing applications the custom ValueEncoders for the entities
are quietly ignored.

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

To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org

View raw message