猿问

mysql查询在数据库正常,但是在java里就报错

select i.id,i.price,i.amount,g.name from orderitem i ,goods g where order_id = ? and i.goods_id = g.id
java.sql.SQLException: Cannot create com.yanzi.model.OrderItem: com.yanzi.model.OrderItem Query: select i.id,i.price,i.amount,g.name from orderitem i ,goods g where order_id = ? and i.goods_id = g.id Parameters: [9]

public List<OrderItem> selectAllItem(int orderid) throws SQLException {
    QueryRunner r = new QueryRunner(DBUtil.getDataSource());        
    String sql = "select i.id,i.price,i.amount,g.name from orderitem i ,goods g where order_id = ? and i.goods_id = g.id";
    System.out.println(sql);    return r.query(sql, new BeanListHandler<OrderItem>(OrderItem.class),orderid);
}


撒科打诨
浏览 688回答 1
1回答
随时随地看视频慕课网APP

相关分类

MySQL
我要回答