ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick <ric...@gmail.com>
Subject Is this simple DAO approach sufficient?
Date Mon, 12 Jan 2009 16:19:30 GMT
I understanding I'm bind my DAOs to a particular sqlmap config being
loaded, but other than some 'purist' unit testing issues, what's wrong
with this simple approach (I'll have a couple different base DAOs that
will load a different config file because going against a different

public abstract class GuiDAO  {
    public static final SqlMapClient sqlMap =

public class UserDAO extends GuiDAO {
    private static UserDAO instance = new UserDAO();
    private UserDAO(){}
    public static UserDAO getInstance() {
        return instance;

    public User getUserByDmzID(String dmzID) throws SQLException {
        return (User)sqlMap.queryForObject("User.getUserByDmzID", dmzID );

Other daos that need a different db will extend a different parent DAO.

What are the big drawback to this?

View raw message