⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productdao.java

📁 sorry i have only one
💻 JAVA
字号:
package cart.dao;import cart.model.Product;import java.util.Collection;import java.sql.*;import java.sql.Connection;import cart.util.ConnUtil;import java.util.HashSet;public class ProductDao implements DAO{  public Collection selectAll(Connection con) throws SQLException{    Collection collection=new HashSet();    String sql="select * from products4";    Statement stm=null;    ResultSet rs=null;    int i=0;    String id=null;    try{      stm=con.createStatement();      rs=stm.executeQuery(sql);      while(rs.next())      {        Product p=new Product();        p.setId(rs.getInt("id"));        p.setName(rs.getString("name"));        p.setDescription(rs.getString("description"));        p.setPrice(rs.getDouble("price"));        collection.add(p);      }    }catch(SQLException e){      throw e;    }finally{      ConnUtil.close(rs,stm);    }    return collection;  }  public Object selectById(Connection con,int id) throws SQLException{    Product product=null;    return product;  }  public void update(Connection con,Object o)throws SQLException{    Product product=(Product)o;  }  public void insert(Connection con,Object o)throws SQLException{    Product product=(Product)o;  }  public void delete(Connection con,int id)throws SQLException{  }  public void delete(Connection con,int[] id)throws SQLException{  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -