org.nutz.castor.FailToCastObjectException: Fail to cast from <java.lang.String> to <com.bw.ces.dao.bean.table.wlgl.TMateriel> for {0} because:
BorningException:Fail to born 'com.bw.ces.dao.bean.table.wlgl.TMateriel'
by args: [
@(0)]
at org.nutz.castor.Castors.cast(Castors.java:264)
at org.nutz.castor.Castors.castTo(Castors.java:318)
@wendal
只能贴一张图 不好意思
@wendal 额 求教啊。大神
@wendal 刚才加了 还是报同样的错误
@wendal public class TMateriel {
/**
* 物料主键
/
@Id(auto = false)
@Prev({ @SQL(db = DB.ORACLE, value = "SELECT SEQ_T_MATERIEL.nextval FROM dual") })
private long materielPk;
/*
* 机构主键
/
@Column("ORGPK")
private long orgPk;
/*
* 货物名称
/
@Column("GOODS")
private String goods;
/*
* 货物规格
/
@Column("SPEC")
private String spec;
/*
* 数量
*/
@Column("QTY")
private int qty;
public TMateriel() {
}
public long getMaterielPk() {
return materielPk;
}
public void setMaterielPk(long materielPk) {
this.materielPk = materielPk;
}
public long getOrgPk() {
return orgPk;
}
public void setOrgPk(long orgPk) {
this.orgPk = orgPk;
}
public String getGoods() {
return goods;
}
public void setGoods(String goods) {
this.goods = goods;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
}
类
@At("/update")
@Ok("json")
public Object update(HttpSession session,
@Param("::materiel_order") MaterielForm mform,
@Param("::materiel") ArrayList materiels) {
try {
// TODOS
TMaterielOrder mOrder = new TMaterielOrder();
boolean isUpdate = materielServiceOrder.isUpdateMord(session,
mOrder);
if (isUpdate) {
return BjuiRespContent.successMsg("修改成功!", "ysgl_wlcrkd", "",
"", true, "", "");
} else {
// 如果为假,则返回修改失败
return BjuiRespContent.errorMsg("有人正在修改,请稍后刷新再试!",
"ysgl_wlcrkd", "", "", false, "", "");
}
} catch (Exception e) {
return BjuiRespContent.errorMsg("修改失败!", "ysgl_wlcrkd", "", "",
false, "", "");
}
}
方法入口
@wendal
public Object update(HttpSession session,
@Param("::materiel_order") MaterielForm mform,
@Param("::materiel") ArrayList materiels) {
}
入口是这个 不知到为什么刚刚那个复制会不同
@wendal 额 新手不太会用
@Param("::materiel_order") MaterielForm mform,
@Param("::materiel") ArrayList materiels
不过我知道原因了,是因为两个@param的前缀一样,框架匹配错误。
希望改进这个bug哦