模糊查询
String sql="select id,name,phone from customer where name like ? and phone like ?"
1.为什么要新建一个CriteriaCustomer类
需要在CustomerDAO接口中定义一个getForListWithCriteriaCustomer(CriteriaCustomer cc)
其中CriteriaCustomer用于封装条件 name,phone 因为查询条件很多时候和domain类并不相同,所以要做单独的类
getter 方法中这样写
public String gerName(){
if(name == null)
name=”%%“
else
name=“%”+name+“%”
return name;
多态
CustomerDAO customerDAO =new CustomerDAOJdbcImpl();