You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephane Decleire <sd...@cariboo-networks.com> on 2008/04/04 12:06:50 UTC

Coercion error in grid

Hi all,

When i try to show a list of my objects in a grid, i get the following 
error :
"Could not find a coercion from type 
org.hibernate.collection.PersistentSet to type com.mycompany.MyType"

Here is my component code :

public class UserAdsList {

    @Parameter(required = true)
    private List<Ad> ads = null;
    public List<Ad> getAds() {
        return ads;
    }
    public void setAds(List<Ad> ads) {
        this.ads = ads;
    }
}


and template :

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

<t:grid source="ads"/>

</t:container>

Any idea ?

Stephane

Re: Coercion error in grid

Posted by Stephane Decleire <sd...@cariboo-networks.com>.
Sorry for the delay of my answer.

It seems that Jonathan is right : the data were retrieved by Hibernate 
as a Set.
I have tried this morning to get a trace of this error but our code has 
come far beyond and i could not reproduce this error anymore. Sorry.
If you need it, i can give you more informations about the context of 
the error.

Stephane

Jonathan Barker a écrit :
> Actually, it wasn't the coercion to GridDataSource I was concerned about.
> It looks like a Set is generated in the page, and then passed to the
> component as a List and then that is used as the source for the grid.
>
> (Having said that, is com.mycompany.MyType a custom type declared for
> Hibernate?)
>
> I experienced strange things back with T4, Hibernate and different
> collection types and inheritance hierarchies when passing parameters.  At
> the time I was a rookie with Hibernate, Spring and Tapestry so it was never
> an issue of "should this work?" it was an issue of "what do I have to do to
> make this work?" 
>
> In addition to the stack trace, the page code (particularly that portion
> generating the collection) would be useful.
>
> Jonathan
>
>   
>> -----Original Message-----
>> From: Howard Lewis Ship [mailto:hlship@gmail.com]
>> Sent: Saturday, April 05, 2008 9:00 AM
>> To: Tapestry users
>> Subject: Re: Coercion error in grid
>>
>> No, I'm pretty sure there's a built-in coercion from Collection to
>> GridDataSource.  Again, a stack trace would be helpful to figure out
>> what's really going on here (and the exact version of Tapestry).
>>
>> On Fri, Apr 4, 2008 at 1:53 PM, Jonathan Barker
>> <jo...@gmail.com> wrote:
>>     
>>>  It sounds like the underlying data (from the page) is in a Set, whereas
>>>       
>> your
>>     
>>>  component wants a List.  Try converting your Set to a List before
>>>       
>> passing to
>>     
>>>  the component.
>>>
>>>
>>>
>>>
>>>  > -----Original Message-----
>>>  > From: Howard Lewis Ship [mailto:hlship@gmail.com]
>>>  > Sent: Friday, April 04, 2008 2:58 PM
>>>  > To: Tapestry users; sdecleire@cariboo-networks.com
>>>  > Subject: Re: Coercion error in grid
>>>  >
>>>  > That is really, really odd.  A stack trace (and the exact version of
>>>  > Tapestry you are using) would be helpful.ß
>>>  >
>>>  > On Fri, Apr 4, 2008 at 3:06 AM, Stephane Decleire
>>>  > <sd...@cariboo-networks.com> wrote:
>>>  > > Hi all,
>>>  > >
>>>  > >  When i try to show a list of my objects in a grid, i get the
>>>       
>> following
>>     
>>>  > > error :
>>>  > >  "Could not find a coercion from type
>>>  > org.hibernate.collection.PersistentSet
>>>  > > to type com.mycompany.MyType"
>>>  > >
>>>  > >  Here is my component code :
>>>  > >
>>>  > >  public class UserAdsList {
>>>  > >
>>>  > >    @Parameter(required = true)
>>>  > >    private List<Ad> ads = null;
>>>  > >    public List<Ad> getAds() {
>>>  > >        return ads;
>>>  > >    }
>>>  > >    public void setAds(List<Ad> ads) {
>>>  > >        this.ads = ads;
>>>  > >    }
>>>  > >  }
>>>  > >
>>>  > >
>>>  > >  and template :
>>>  > >
>>>  > >  <t:container
>>>  > > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>>  > >
>>>  > >  <t:grid source="ads"/>
>>>  > >
>>>  > >  </t:container>
>>>  > >
>>>  > >  Any idea ?
>>>  > >
>>>  > >  Stephane
>>>  > >
>>>  >
>>>  >
>>>  >
>>>  > --
>>>  > Howard M. Lewis Ship
>>>  >
>>>  > Creator Apache Tapestry and Apache HiveMind
>>>  >
>>>  > ---------------------------------------------------------------------
>>>  > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>  > For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>  ---------------------------------------------------------------------
>>>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>  For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>       
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>   

RE: Coercion error in grid

Posted by Jonathan Barker <jo...@gmail.com>.
Actually, it wasn't the coercion to GridDataSource I was concerned about.
It looks like a Set is generated in the page, and then passed to the
component as a List and then that is used as the source for the grid.

(Having said that, is com.mycompany.MyType a custom type declared for
Hibernate?)

I experienced strange things back with T4, Hibernate and different
collection types and inheritance hierarchies when passing parameters.  At
the time I was a rookie with Hibernate, Spring and Tapestry so it was never
an issue of "should this work?" it was an issue of "what do I have to do to
make this work?" 

In addition to the stack trace, the page code (particularly that portion
generating the collection) would be useful.

Jonathan

> -----Original Message-----
> From: Howard Lewis Ship [mailto:hlship@gmail.com]
> Sent: Saturday, April 05, 2008 9:00 AM
> To: Tapestry users
> Subject: Re: Coercion error in grid
> 
> No, I'm pretty sure there's a built-in coercion from Collection to
> GridDataSource.  Again, a stack trace would be helpful to figure out
> what's really going on here (and the exact version of Tapestry).
> 
> On Fri, Apr 4, 2008 at 1:53 PM, Jonathan Barker
> <jo...@gmail.com> wrote:
> >
> >  It sounds like the underlying data (from the page) is in a Set, whereas
> your
> >  component wants a List.  Try converting your Set to a List before
> passing to
> >  the component.
> >
> >
> >
> >
> >  > -----Original Message-----
> >  > From: Howard Lewis Ship [mailto:hlship@gmail.com]
> >  > Sent: Friday, April 04, 2008 2:58 PM
> >  > To: Tapestry users; sdecleire@cariboo-networks.com
> >  > Subject: Re: Coercion error in grid
> >  >
> >  > That is really, really odd.  A stack trace (and the exact version of
> >  > Tapestry you are using) would be helpful.ß
> >  >
> >  > On Fri, Apr 4, 2008 at 3:06 AM, Stephane Decleire
> >  > <sd...@cariboo-networks.com> wrote:
> >  > > Hi all,
> >  > >
> >  > >  When i try to show a list of my objects in a grid, i get the
> following
> >  > > error :
> >  > >  "Could not find a coercion from type
> >  > org.hibernate.collection.PersistentSet
> >  > > to type com.mycompany.MyType"
> >  > >
> >  > >  Here is my component code :
> >  > >
> >  > >  public class UserAdsList {
> >  > >
> >  > >    @Parameter(required = true)
> >  > >    private List<Ad> ads = null;
> >  > >    public List<Ad> getAds() {
> >  > >        return ads;
> >  > >    }
> >  > >    public void setAds(List<Ad> ads) {
> >  > >        this.ads = ads;
> >  > >    }
> >  > >  }
> >  > >
> >  > >
> >  > >  and template :
> >  > >
> >  > >  <t:container
> >  > > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >  > >
> >  > >  <t:grid source="ads"/>
> >  > >
> >  > >  </t:container>
> >  > >
> >  > >  Any idea ?
> >  > >
> >  > >  Stephane
> >  > >
> >  >
> >  >
> >  >
> >  > --
> >  > Howard M. Lewis Ship
> >  >
> >  > Creator Apache Tapestry and Apache HiveMind
> >  >
> >  > ---------------------------------------------------------------------
> >  > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >  > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >  For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
> 
> --
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: Coercion error in grid

Posted by Howard Lewis Ship <hl...@gmail.com>.
No, I'm pretty sure there's a built-in coercion from Collection to
GridDataSource.  Again, a stack trace would be helpful to figure out
what's really going on here (and the exact version of Tapestry).

On Fri, Apr 4, 2008 at 1:53 PM, Jonathan Barker
<jo...@gmail.com> wrote:
>
>  It sounds like the underlying data (from the page) is in a Set, whereas your
>  component wants a List.  Try converting your Set to a List before passing to
>  the component.
>
>
>
>
>  > -----Original Message-----
>  > From: Howard Lewis Ship [mailto:hlship@gmail.com]
>  > Sent: Friday, April 04, 2008 2:58 PM
>  > To: Tapestry users; sdecleire@cariboo-networks.com
>  > Subject: Re: Coercion error in grid
>  >
>  > That is really, really odd.  A stack trace (and the exact version of
>  > Tapestry you are using) would be helpful.ß
>  >
>  > On Fri, Apr 4, 2008 at 3:06 AM, Stephane Decleire
>  > <sd...@cariboo-networks.com> wrote:
>  > > Hi all,
>  > >
>  > >  When i try to show a list of my objects in a grid, i get the following
>  > > error :
>  > >  "Could not find a coercion from type
>  > org.hibernate.collection.PersistentSet
>  > > to type com.mycompany.MyType"
>  > >
>  > >  Here is my component code :
>  > >
>  > >  public class UserAdsList {
>  > >
>  > >    @Parameter(required = true)
>  > >    private List<Ad> ads = null;
>  > >    public List<Ad> getAds() {
>  > >        return ads;
>  > >    }
>  > >    public void setAds(List<Ad> ads) {
>  > >        this.ads = ads;
>  > >    }
>  > >  }
>  > >
>  > >
>  > >  and template :
>  > >
>  > >  <t:container
>  > > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>  > >
>  > >  <t:grid source="ads"/>
>  > >
>  > >  </t:container>
>  > >
>  > >  Any idea ?
>  > >
>  > >  Stephane
>  > >
>  >
>  >
>  >
>  > --
>  > Howard M. Lewis Ship
>  >
>  > Creator Apache Tapestry and Apache HiveMind
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  > For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


RE: Coercion error in grid

Posted by Jonathan Barker <jo...@gmail.com>.
It sounds like the underlying data (from the page) is in a Set, whereas your
component wants a List.  Try converting your Set to a List before passing to
the component.


> -----Original Message-----
> From: Howard Lewis Ship [mailto:hlship@gmail.com]
> Sent: Friday, April 04, 2008 2:58 PM
> To: Tapestry users; sdecleire@cariboo-networks.com
> Subject: Re: Coercion error in grid
> 
> That is really, really odd.  A stack trace (and the exact version of
> Tapestry you are using) would be helpful.ß
> 
> On Fri, Apr 4, 2008 at 3:06 AM, Stephane Decleire
> <sd...@cariboo-networks.com> wrote:
> > Hi all,
> >
> >  When i try to show a list of my objects in a grid, i get the following
> > error :
> >  "Could not find a coercion from type
> org.hibernate.collection.PersistentSet
> > to type com.mycompany.MyType"
> >
> >  Here is my component code :
> >
> >  public class UserAdsList {
> >
> >    @Parameter(required = true)
> >    private List<Ad> ads = null;
> >    public List<Ad> getAds() {
> >        return ads;
> >    }
> >    public void setAds(List<Ad> ads) {
> >        this.ads = ads;
> >    }
> >  }
> >
> >
> >  and template :
> >
> >  <t:container
> > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >
> >  <t:grid source="ads"/>
> >
> >  </t:container>
> >
> >  Any idea ?
> >
> >  Stephane
> >
> 
> 
> 
> --
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: Coercion error in grid

Posted by Howard Lewis Ship <hl...@gmail.com>.
That is really, really odd.  A stack trace (and the exact version of
Tapestry you are using) would be helpful.ß

On Fri, Apr 4, 2008 at 3:06 AM, Stephane Decleire
<sd...@cariboo-networks.com> wrote:
> Hi all,
>
>  When i try to show a list of my objects in a grid, i get the following
> error :
>  "Could not find a coercion from type org.hibernate.collection.PersistentSet
> to type com.mycompany.MyType"
>
>  Here is my component code :
>
>  public class UserAdsList {
>
>    @Parameter(required = true)
>    private List<Ad> ads = null;
>    public List<Ad> getAds() {
>        return ads;
>    }
>    public void setAds(List<Ad> ads) {
>        this.ads = ads;
>    }
>  }
>
>
>  and template :
>
>  <t:container
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>
>  <t:grid source="ads"/>
>
>  </t:container>
>
>  Any idea ?
>
>  Stephane
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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