예제 #1
0
  @Override
  public ManagerPanel getById(int userId) throws DbException {
    PreparedStatement ps = null;
    ResultSet rs = null;
    ManagerPanel managerPanel = null;
    try {
      managerPanel = new ManagerPanel();

      prepareConnection();

      ps = connection.prepareStatement(MANAGER_SELECT_BY_ID);
      ps.setInt(1, userId);
      rs = ps.executeQuery();

      rs.next();
      Money finresult = Money.dollars(rs.getDouble("summaryfinresult"));
      managerPanel.setSummaryFinRes(finresult);

    } catch (SQLException e) {
      throw new DbException("Can't execute SQL = '" + MANAGER_SELECT_BY_ID + "'", e);
    } finally {
      daoHelper.closeDataBaseEntities(ps, rs, connection);
    }
    return managerPanel;
  }