On May 30, 2008, at 12:54 AM, Timo Rantalaiho wrote:
On Thu, 29 May 2008, David Nedrow wrote:
public class ProtocolDAO extends JpaDaoSupport implements
IProtocolDAO
...
public class ShowProtocolsPanel extends Panel {
@SpringBean(name="ProtocolDAO")
private ProtocolDAO dao;
Clearly this should be IProtocolDao, so that the component
depends on interface and not on implementation.
So, you're saying it should be...
@SpringBean(name="ProtocolDAO")
private IProtocolDAO dao;
When simply using the dao without injection, I would normally do
something like...
private IProtocolDAO dao = new ProtocolDAO();
Regardless, even pointing the dependency at the interface still yields
a class cast exception.
If it were a failure of the way I'm calling the DAO, I would assume
that my class would fail inside the IModel declaration, right?
IModel protocolModel = new LoadableDetachableModel() {
protected Object load() {
return dao.findAll();
}
};
add(new ListView("eachItem", protocolModel) {
@Override protected void populateItem(ListItem item) {
Protocol protocol = (Protocol) item.getModelObject();
item.add(new Label("keyword", protocol.getKeyword()));
item.add(new Label("description",
protocol.getDescription()));
}
});
WicketMessage: Error attaching this container for rendering:
[MarkupContainer [Component id = showProtoPanel, page =
com.foo.pages.HomePage, path =
2:tabs:tabs:panel:tabs:panel:showProtoPanel.ShowProtocolsPanel,
isVisible = true, isVersioned = true]]
Root cause:
java.lang.ClassCastException: com.vzbi.ncs.argfrp.jpa.netconf.Protocol
at com.foo.pages.panels.ShowProtocolsPanel
$2.populateItem(ShowProtocolsPanel.java:49)
at
org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:
573)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]