The method getItemNo() is undefined for the type Item怎么解决!!

mark000b 2013-05-03 04:52:46
The method getItemNo() is undefined for the type Item怎么解决
public class ItemDao4OracleImpl implements ItemDao {

public void addItem(Connection conn, Item item) {
String sql="insert into t_items(item_no,itme_category_id,item_unit_id,item_name,spec,pattern)";
sql+=" values(?,?,?,?,?,?)";
PreparedStatement pstmt= null;
try{
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, item.getItemNo());
pstmt.setString(2, item.getItemName());
pstmt.setString(3, item.getSpec());
pstmt.setString(4, item.getPattern());
pstmt.setString(5, item.getItemCategory().getId());
pstmt.setString(6, item.getItemUnit().getId());
为什么显示:The method getItemNo() is undefined for the type Item?
Item 类里我已经定义了:
private String itemNo;
private String itemName;
private String spec;
private String pttern;
private ItemCategory itemCategory;
private ItemUnit itemUnit;
...全文
9543 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
mark000b 2013-05-03
  • 打赏
  • 举报
回复
引用 13 楼 liuyuhua0066 的回复:
import com.sun.mail.imap.protocol.Item; !!!!!!
搞定谢谢!!!
liuyuhua0066 2013-05-03
  • 打赏
  • 举报
回复
liuyuhua0066 2013-05-03
  • 打赏
  • 举报
回复
import com.sun.mail.imap.protocol.Item; !!!!!!
mark000b 2013-05-03
  • 打赏
  • 举报
回复
引用 11 楼 mark000b 的回复:
[quote=引用 8 楼 yousteely 的回复:] 把你的item类贴出来
package com.bjpowernode.drp.basedata.domain; import com.bjpowernode.drp.util.datadict.domain.ItemCategory; import com.bjpowernode.drp.util.datadict.domain.ItemUnit; /** * 物料实体类 * @author lenovo * */ public class Item { private String itemNo; private String itemName; private String spec; private String pttern; //g关联物料类别ItemCategory private ItemCategory itemCategory; private ItemUnit itemUnit; public String getItemNo() { return itemNo; } public void setItemNo(String itemNo) { this.itemNo = itemNo; } public String getItemName() { return itemName; } public void setItemName(String itemName) { this.itemName = itemName; } public String getSpec() { return spec; } public void setSpec(String spec) { this.spec = spec; } public String getPttern() { return pttern; } public void setPttern(String pttern) { this.pttern = pttern; } public ItemCategory getItemCategory() { return itemCategory; } public void setItemCategory(ItemCategory itemCategory) { this.itemCategory = itemCategory; } public ItemUnit getItemUnit() { return itemUnit; } public void setItemUnit(ItemUnit itemUnit) { this.itemUnit = itemUnit; } } [/quote] ----------------------------------------------------------------------------------------- package com.bjpowernode.drp.basedata.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import com.bjpowernode.drp.util.ApplicationException; import com.bjpowernode.drp.util.DbUtil; import com.bjpowernode.drp.util.PageModel; import com.sun.mail.imap.protocol.Item; public class ItemDao4OracleImpl implements ItemDao { public void addItem(Connection conn, Item item) { String sql="insert into t_items(item_no,itme_category_id,item_unit_id,item_name,spec,pattern)"; sql+=" values(?,?,?,?,?,?)"; PreparedStatement pstmt= null; try{ pstmt = conn.prepareStatement(sql); pstmt.setString(1, item.getItemNo()); pstmt.setString(2, item.getItemName()); pstmt.setString(3, item.getSpec()); pstmt.setString(4, item.getPattern()); pstmt.setString(5, item.getItemCategory().getId()); pstmt.setString(6, item.getItemUnit().getId()); pstmt.executeUpdate(); }catch(SQLException e){ e.printStackTrace(); throw new ApplicationException("添加物料失败!"); }finally{ DbUtil.close(pstmt); } } public void delItem(Connection conn, String[] itemNos) { // TODO Auto-generated method stub } public Item findItemById(Connection conn, String itemNo) { // TODO Auto-generated method stub return null; } public PageModel findItemList(Connection conn,int pageNo, int pageSize, String condation) { // TODO Auto-generated method stub return null; } public void modifyItem(Connection conn, Item item) { // TODO Auto-generated method stub } }
mark000b 2013-05-03
  • 打赏
  • 举报
回复
引用 8 楼 yousteely 的回复:
把你的item类贴出来
package com.bjpowernode.drp.basedata.domain; import com.bjpowernode.drp.util.datadict.domain.ItemCategory; import com.bjpowernode.drp.util.datadict.domain.ItemUnit; /** * 物料实体类 * @author lenovo * */ public class Item { private String itemNo; private String itemName; private String spec; private String pttern; //g关联物料类别ItemCategory private ItemCategory itemCategory; private ItemUnit itemUnit; public String getItemNo() { return itemNo; } public void setItemNo(String itemNo) { this.itemNo = itemNo; } public String getItemName() { return itemName; } public void setItemName(String itemName) { this.itemName = itemName; } public String getSpec() { return spec; } public void setSpec(String spec) { this.spec = spec; } public String getPttern() { return pttern; } public void setPttern(String pttern) { this.pttern = pttern; } public ItemCategory getItemCategory() { return itemCategory; } public void setItemCategory(ItemCategory itemCategory) { this.itemCategory = itemCategory; } public ItemUnit getItemUnit() { return itemUnit; } public void setItemUnit(ItemUnit itemUnit) { this.itemUnit = itemUnit; } }
mark000b 2013-05-03
  • 打赏
  • 举报
回复
求解决方法!!
  • 打赏
  • 举报
回复
文本编辑器里面敲的代码吧。。。。 名字坑爹是敲错了,看看是不是大小写原因,或者干脆把item里的方法复制过来试试吧。。。。
steely_chen 2013-05-03
  • 打赏
  • 举报
回复
把你的item类贴出来
mark000b 2013-05-03
  • 打赏
  • 举报
回复
引用 4 楼 xxhhbb1538 的回复:
编译都不通过吧
恩是啊提示:The method getItemNo() is undefined for the type Item
mark000b 2013-05-03
  • 打赏
  • 举报
回复
引用 5 楼 mark000b 的回复:
引用 3 楼 liuyuhua0066 的回复:
提示已经很明显了
我定义了set和get方法了?
还是不行了?
mark000b 2013-05-03
  • 打赏
  • 举报
回复
引用 3 楼 liuyuhua0066 的回复:
提示已经很明显了
我定义了set和get方法了?
  • 打赏
  • 举报
回复
编译都不通过吧
liuyuhua0066 2013-05-03
  • 打赏
  • 举报
回复
提示已经很明显了
mark000b 2013-05-03
  • 打赏
  • 举报
回复
我定义了get和set方法了,pstmt.setString(1, item.getItemNo());我这样调用是说没有定义了!!! 求解答!
LCore 2013-05-03
  • 打赏
  • 举报
回复
说的很明白了Item类中没有定义 getItemNo()方法,虽然类中有itemNo字段 你却没有编写getItemNo()方法

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧