Example usage for org.springframework.dao IncorrectResultSizeDataAccessException getMessage

List of usage examples for org.springframework.dao IncorrectResultSizeDataAccessException getMessage

Introduction

In this page you can find the example usage for org.springframework.dao IncorrectResultSizeDataAccessException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:com.sfs.whichdoctor.dao.WorkshopDAOImpl.java

/**
 * Used to get a WorkshopBean for a workshop Id.
 *
 * @param workshopId the workshop id/*from   w w  w. j  a va 2 s.  co  m*/
 * @return the workshop bean
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final WorkshopBean load(final int workshopId) throws WhichDoctorDaoException {

    dataLogger.info("WorkshopId: " + workshopId + " requested");

    final String loadId = getSQL().getValue("workshop/load") + " WHERE workshop.WorkshopId = ?";

    WorkshopBean workshop = null;

    try {
        workshop = (WorkshopBean) this.getJdbcTemplateReader().queryForObject(loadId,
                new Object[] { workshopId }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadWorkshop(rs, true);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results for this search: " + ie.getMessage());
    }
    return workshop;
}

From source file:com.sfs.dao.BackupDAOImpl.java

/**
 * Gets the table names./*w w  w  .j  a v  a 2s.c o m*/
 *
 * @return the table names as a collection of strings
 */
@SuppressWarnings("unchecked")
private Collection<String> getTables() {
    Collection<String> tables = null;

    try {
        tables = this.getJdbcTemplateReader().query(getSQL().getValue("backup/showtables"), new RowMapper() {
            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                return rs.getString(1);
            }
        });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No tables results found: " + ie.getMessage());
    }
    return tables;
}

From source file:com.sfs.whichdoctor.dao.ExpenseClaimDAOImpl.java

/**
 * Load the expense claim bean.//from   w  ww .ja va  2 s  . c om
 *
 * @param expenseClaimId the expense claim id
 * @return the expense claim bean
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final ExpenseClaimBean load(final int expenseClaimId) throws WhichDoctorDaoException {

    dataLogger.info("Getting expenseClaimId:" + expenseClaimId);

    final String loadId = getSQL().getValue("expenseclaim/load") + " WHERE expenseclaim.ExpenseClaimId = ?";

    ExpenseClaimBean expenseClaim = null;
    try {
        expenseClaim = (ExpenseClaimBean) this.getJdbcTemplateReader().queryForObject(loadId,
                new Object[] { expenseClaimId }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadExpenseClaim(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results for this search: " + ie.getMessage());
    }
    return expenseClaim;
}

From source file:com.sfs.whichdoctor.dao.WorkshopDAOImpl.java

/**
 * Used to get a Collection of WorkshopBeans for a specified GUID number.
 *
 * @param guid the guid/*  w ww  .  ja  v  a  2  s . c o m*/
 * @param fullResults the full results
 * @return the collection
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<WorkshopBean> load(final int guid, final boolean fullResults)
        throws WhichDoctorDaoException {

    dataLogger.info("Workshops for GUID: " + guid + " requested");

    final String loadWorkshops = getSQL().getValue("workshop/load")
            + " WHERE workshop.Active = true AND workshop.ReferenceGUID = ?" + " ORDER BY workshop.Date";

    Collection<WorkshopBean> workshops = new ArrayList<WorkshopBean>();

    try {
        workshops = this.getJdbcTemplateReader().query(loadWorkshops, new Object[] { guid }, new RowMapper() {
            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                return loadWorkshop(rs, true);
            }
        });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results for this search: " + ie.getMessage());
    }
    return workshops;
}

From source file:com.sfs.whichdoctor.dao.ExpenseClaimDAOImpl.java

/**
 * Used to get a Collection of ExpenseClaimBean details for a specified GUID number.
 *
 * @param guid the guid//from  w ww  . j a v  a 2s . c  o  m
 * @param fullResults the full results
 * @return the collection
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<ExpenseClaimBean> load(final int guid, final boolean fullResults)
        throws WhichDoctorDaoException {

    dataLogger.info("Expense claims for GUID: " + guid + " requested");

    final String loadSQL = getSQL().getValue("expenseclaim/load")
            + " WHERE expenseclaim.Active = true AND expenseclaim.ReferenceGUID = ?"
            + " ORDER BY expenseclaim.ExpenseDate";

    Collection<ExpenseClaimBean> expenseClaims = new ArrayList<ExpenseClaimBean>();

    try {
        expenseClaims = this.getJdbcTemplateReader().query(loadSQL, new Object[] { guid }, new RowMapper() {
            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                return loadExpenseClaim(rs);
            }
        });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results for this search: " + ie.getMessage());
    }
    return expenseClaims;
}

From source file:com.sfs.dao.BackupDAOImpl.java

/**
 * Gets the table descriptions.//from   w w  w  .  ja va2  s . c om
 *
 * @param sql the sql string
 *
 * @return the table descriptions as a collection of strings
 */
@SuppressWarnings("unchecked")
private Collection<String> getTableDesc(final String sql) {
    Collection<String> tableDescriptions = null;
    try {
        tableDescriptions = this.getJdbcTemplateReader().query(sql, new RowMapper() {
            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                return rs.getString(2);
            }
        });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No table description results found: " + ie.getMessage());
    }
    if (tableDescriptions == null) {
        tableDescriptions = new ArrayList<String>();
    }
    return tableDescriptions;
}

From source file:com.sfs.whichdoctor.dao.MemoDAOImpl.java

/**
 * Load the MemoBean.//from  w w w. ja  v  a 2 s  .  c  o m
 *
 * @param memoId the memo id
 * @return the memo bean
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final MemoBean load(final int memoId) throws WhichDoctorDaoException {

    dataLogger.info("Getting memoId:" + memoId);

    final String loadMemoId = getSQL().getValue("memo/load") + " WHERE memo.MemoId = ?";

    MemoBean memo = null;

    try {
        memo = (MemoBean) this.getJdbcTemplateReader().queryForObject(loadMemoId, new Object[] { memoId },
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadMemo(rs, true);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.info("No results found for this search: " + ie.getMessage());
    }
    return memo;
}

From source file:com.sfs.whichdoctor.dao.MemoDAOImpl.java

/**
 * Used to get a Collection of MemoBean details for a specified GUID number.
 *
 * @param guid the guid/*  w  ww.j  av a2 s  .c  om*/
 * @param fullResults the full results
 * @return the collection
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<MemoBean> load(final int guid, final boolean fullResults)
        throws WhichDoctorDaoException {

    dataLogger.info("Memos for GUID: " + guid + " requested");

    final String loadMemo = getSQL().getValue("memo/load")
            + " WHERE memo.ReferenceGUID = ? AND memo.Active = true"
            + " ORDER BY memo.Priority ASC, guid.CreatedDate DESC";

    Collection<MemoBean> memos = new ArrayList<MemoBean>();

    try {
        memos = this.getJdbcTemplateReader().query(loadMemo, new Object[] { guid }, new RowMapper() {
            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                return loadMemo(rs, fullResults);
            }
        });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.info("No results found for this search: " + ie.getMessage());
    }
    return memos;
}

From source file:com.sfs.dao.BackupDAOImpl.java

/**
 * Gets the table contents./*from w  w w .  java  2s.  co m*/
 *
 * @param sql the sql string
 *
 * @return the table contents
 */
@SuppressWarnings("unchecked")
private Collection<String> getTableContents(final String sql) {
    Collection<String> tableContents = null;
    try {
        tableContents = this.getJdbcTemplateReader().query(sql, new RowMapper() {
            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {

                int colCount = rs.getMetaData().getColumnCount();

                final StringBuffer sqlValues = new StringBuffer();

                sqlValues.append("(");

                for (int x = 1; x < colCount + 1; x++) {
                    String data = null;
                    try {
                        data = rs.getString(x);
                    } catch (SQLException sqe) {
                        dataLogger.debug("Error getting data field: " + sqe.getMessage());
                    }

                    sqlValues.append("\'");
                    if (data != null) {
                        sqlValues.append(filterData(data));
                    }
                    sqlValues.append("\'");
                    if (x < colCount) {
                        sqlValues.append(", ");
                    }
                }
                sqlValues.append(")");

                return sqlValues.toString();
            }
        });
    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No table contents results found: " + ie.getMessage());
    }
    if (tableContents == null) {
        tableContents = new ArrayList<String>();
    }
    return tableContents;
}

From source file:com.sfs.whichdoctor.dao.QualificationDAOImpl.java

/**
 * Load the qualification bean.//from   ww w.j  av  a2s  . co m
 *
 * @param qualificationId the qualification id
 * @return the qualification bean
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final QualificationBean load(final int qualificationId) throws WhichDoctorDaoException {

    dataLogger.info("Getting qualificationId:" + qualificationId);

    final String loadQualificationId = getSQL().getValue("qualification/load")
            + " WHERE qualification.QualificationId = ?";

    QualificationBean qualification = null;

    try {
        qualification = (QualificationBean) this.getJdbcTemplateReader().queryForObject(loadQualificationId,
                new Object[] { qualificationId }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadQualification(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results found for this search: " + ie.getMessage());
    }
    return qualification;
}