Using the annotation triggers slightly different exception.

   - org.apache.tapestry5.runtime.ComponentEventException
   Exception in method null, parameter #1: Could not find a coercion from
   type java.lang.String to type Scene.
   context
      - 3
   eventTypeactivate


Also annotation wont, really work for me as I have more then one field

    public void onActivate(Scene scene, Shot shot, ShotComponent component,
ShotDataSection section) {
        selectedScene = scene;
        selectedShot = shot;
        selectedComponent = component;
        selectedSection = section;

        if (!scene.getProject().equals(user.getSelectedProject())) {
            user.setSelectedProject(scene.getProject());
        }

        shotComponents = systemManager.getComponents(selectedShot, filter);
        CollectionUtils.sortComponents(shotComponents);
    }

    public void onActivate(Scene scene, Shot shot, ShotComponent component)
{
        onActivate(scene, shot, component, null);
    }

    public void onActivate(Scene scene, Shot shot) {
        onActivate(scene, shot, null);
    }

    public void onActivate(Scene scene) {
        onActivate(scene, null);
    }

And all of those select* fields are marked with

    @Property
    @Persist

So the question still remains, how come that tapestry fails to pick up that
context is a number and then it fails to user hibernate ValueEncoder.

Thanks for the help guys

On Tue, Sep 9, 2014 at 8:38 PM, Boris Horvat <horvat.z.bo...@gmail.com>
 wrote:

> It is a hibernate entity so yea it gets a ValueEncoder from hibernate. As
> mentioned when I first navigate to the page, it works fine, but after form
> submit it breaks...
>
> I will remove return type and try annotation and see if that helps
>
> On Tue, Sep 9, 2014 at 2:33 PM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
>> On Tue, 09 Sep 2014 04:10:22 -0300, Boris Horvat <
>> horvat.z.bo...@gmail.com> wrote:
>>
>> Hi my methods look like this
>>>
>>>     public boolean onActivate(Scene scene) {
>>>         selectedScene =
>>> scene;//systemManager.getScene(Long.parseLong(scene.toString()));
>>>         return selectedScene != null;
>>>     }
>>>
>>>     public Scene onPassivate() {
>>>         return selectedScene;
>>>     }
>>>
>>> I don't have ValueEncoder cause I would expect that conversion works
>>> String
>>> -> Long -> hibernate gets the id of the object and returns -> MyObject
>>> (i.e. Scene in this case).
>>>
>>
>> I don't think your assumption is correct. For onActivate(Scene) to work,
>> you need a ValueEncoder for Scene or at least String to Scene coercion.
>> Same for onActivate(). As Lance said, if you're using tapestry-hibernate
>> and Scene is a Hibernate entity, Scene already has a ValueEncoder
>> automatically contributed.
>>
>> As Lance said, you should never return boolean in onActivate(). It's not
>> a component render phase event handler.
>>
>> I can add one but I would not expect that I needed it, especially since
>>> when I first navigate to the page it works without a problem, but when I
>>> submit a form it breaks
>>> org.apache.tapestry5.ioc.util.UnknownValueException
>>> Could not find a coercion from type java.lang.String to type
>>> domain.Scene.
>>>
>>
>> This matches what I said above.
>>
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Tapestry, Java and Hibernate consultant and developer
>> http://machina.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
> --
> Sincerely
> *Boris Horvat*
>



-- 
Sincerely
*Boris Horvat*

Reply via email to