Try providing the BeanModel explicitly using the Grid's model parameter
and BeanModelSource.
On Fri, 03 Feb 2012 14:44:21 -0200, Szemere Szemere
<szemereszem...@gmail.com> wrote:
I'm getting a strange cast class exception with the grid component, along
the lines of:
Render queue error in BeginRender[admin/WidgetList:grid.rows.gridcell]:
com.companyname.data.Widget cannot be cast to
com.companyname.data.Widget_$$_javassist_0
The code is simple and clean and I don't get it elsewhere, so I'm
puzzled.
Any ideas of where to look?
The code is similar to the following (names changed to protect the
innocent):
tml includes:
<t:grid t:pagerPosition="both"
source="widgetList"
row="widgetLoop"
rowsPerPage="50" >
<t:parameter name="nameCell">
<t:pagelink page="admin/stuff/WidgetEdit"
context="widgetLoop.id">
${widgetLoop.name}
</t:pagelink>
</t:parameter>
</t:grid>
.java:
package com.companyname.web.pages.admin;
import java.util.List;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;
import com.companyname.data.Widget;
import com.companyname.web.pages.SecuredPage;
public class WidgetList extends SecuredPage {
@Inject private Session session;
@Property List<Widget> widgets;
/**
* stores current group for loop usage
*/
@Property private Widget widgetLoop;
void onActivate(Object[] context) {
//no-op
}
@SuppressWarnings("unchecked")
void setupRender() {
widgets = (List<Widget>)
session.createCriteria(Widget.class).list();
}
public List<Widget> getWidgetList() {
return widgets;
}
}
package com.companyname.data;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Set;
public class Widget {
public static final String USEFUL_NAME = "help";
private Long id;
private String name;
private Set<Item> items = new HashSet<Item>();
private Date createdDate;
private String description;
public Widget() {
//if this is a persistent instance, then the createdDate will be
//recovered from the DB and set post-constructor
createdDate = new GregorianCalendar().getTime();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Item> getItems() {
return items;
}
public void setItems(Set<Item> items) {
this.items = items;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org