Package org.xooof.xooofoscope.dao.exception

Examples of org.xooof.xooofoscope.dao.exception.UserDAOException


   * @see org.xooof.xooofoscope.dao.IUserDAO#exist(java.lang.Integer)
   */
  public SUser fetchByPK(Integer userId) throws DAOException {

    if (userId == null) {
      throw new UserDAOException("userId cannot be null");
    }
    SUser user = null;
    PreparedStatement statement = null;
    ResultSet result;
    Connection connection = DAOHelper.getDBConnection();
    try {
      try {
        statement = connection.prepareStatement(FETCHBYPK_QRY);
        statement.setInt(1, userId.intValue());
        result = statement.executeQuery();
        if (result.next()) {
          user = new SUser();
          user.setObjId(result.getString("id"));
          user.setObjClass(SUser.class.getName());
          user.setName(result.getString("name"));
          if (result.next()) {
            throw new UserDAOException(
              "Multiple rows exists for userId " + userId.toString());
          }
        } else {
          user = null;
        }
      } catch (SQLException exc) {
        throw new UserDAOException(exc.getMessage());
      } //End catch IOException
    }
    // This code is to be executed each time in order to release DB Connections
    finally {
      try {
View Full Code Here


          user.setObjClass(SUser.class.getName());
          user.setName(result.getString("name"));
          userList.add(user);
        }
      } catch (SQLException exc) {
        throw new UserDAOException(exc.getMessage());
      } //End catch IOException
    }
    // This code is to be executed each time in order to release DB Connections
    finally {
      try {
View Full Code Here

TOP

Related Classes of org.xooof.xooofoscope.dao.exception.UserDAOException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.