Hi,

I'm having an issue that I suspect is related to the wicket integration
with Guice. Any help is appreciated.

I have a Page class that uses field injection to inject a DAO. I then want
to cast my DAO to a more specific type (what I inject is the interface).
Here's what that looks like

public class CnavModify extends ConsoleBasePage {

    @Inject private CnavUrlDAO cnavUrlDAO;
    public CnavModify(PageParameters parameters) {
        super(parameters);
        if (parameters.get("cnavid").toString() != null) {
            cnavid = new ObjectId(parameters.get("cnavid").toString());
        }
        if (cnavid != null) {
            cnavUrlModel = new
DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
        }
    }
}

When I try to cast it I get the following error:

Last cause: $Proxy23 cannot be cast to
com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO

I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23
and I am unable to cast it to a concrete type.

Is this Guice or Wicket related? Any idea how to get around this?

Thanks,
Daniel

Reply via email to