如下代码所示:
public interface UserDAO {
public List loadUser()throws SQLException;
public void saveUser(User user)throws SQLException;
public int updateUser(User user)throws SQLException;
}public class UserDAOImpl implements UserDAO{
public int updateUser(User user)throws SQLException{
int result = 0;
return result;
}
}很简单,就是一个DAO接口和一个接口实现类,至于是用什么手段进行持久化
都无关紧要。如上代码所示
update这方法返回值为int类型的,这个返回值有用吗?(我的想法是想根据返回值判断持久化操作成功还是失败,不知道这么想对么?)
如果是对的,那么通过返回值来判断持久化操作是否成功.该返回值是在struts的Action中进行判断还是业务逻辑层判断?
public interface UserDAO {
public List loadUser()throws SQLException;
public void saveUser(User user)throws SQLException;
public int updateUser(User user)throws SQLException;
}public class UserDAOImpl implements UserDAO{
public int updateUser(User user)throws SQLException{
int result = 0;
return result;
}
}很简单,就是一个DAO接口和一个接口实现类,至于是用什么手段进行持久化
都无关紧要。如上代码所示
update这方法返回值为int类型的,这个返回值有用吗?(我的想法是想根据返回值判断持久化操作成功还是失败,不知道这么想对么?)
如果是对的,那么通过返回值来判断持久化操作是否成功.该返回值是在struts的Action中进行判断还是业务逻辑层判断?
我不明白你为什么要返回一个int
如果满足条件并且不抛异常的话就更新成功,这样可以在action里写request.setAttribute(“”,“”);就可以了。
真不知道该怎么弄,请教下你们都是在什么地方进行判断的呢?