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.OnlineToolDAOImpl.java

/**
 * Loads an array of online tool beans for the supplied reference GUID.
 *
 * @param referenceGUID the reference GUID
 *
 * @return the collection< online tool bean>
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 *///from   w  ww.j av a 2s . co  m
@SuppressWarnings("unchecked")
public final Collection<OnlineToolBean> load(final int referenceGUID) throws WhichDoctorDaoException {

    Collection<OnlineToolBean> onlineTools = new ArrayList<OnlineToolBean>();

    try {
        onlineTools = this.getJdbcTemplateReader().query(this.getSQL().getValue("onlineTool/load"),
                new Object[] { referenceGUID }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadOnlineTool(rs);
                    }
                });

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

    return onlineTools;
}

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

/**
 * Loads an array of online tool beans for the supplied rotation GUID.
 *
 * @param rotationGUID the rotation GUID
 *
 * @return the collection< online tool bean>
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 *//*from  w  ww  .  j a v  a  2s.  co m*/
@SuppressWarnings("unchecked")
public final Collection<OnlineToolBean> loadRotation(final int rotationGUID) throws WhichDoctorDaoException {

    Collection<OnlineToolBean> onlineTools = new ArrayList<OnlineToolBean>();

    try {
        onlineTools = this.getJdbcTemplateReader().query(this.getSQL().getValue("onlineTool/loadRotation"),
                new Object[] { rotationGUID }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadOnlineTool(rs);
                    }
                });

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

    return onlineTools;
}

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

/**
 * Loads all of the online tool beans./*from   www  .  j av a 2 s  .c  o  m*/
 *
 * @return the collection< online tool bean>
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<OnlineToolBean> loadAll() throws WhichDoctorDaoException {

    Collection<OnlineToolBean> onlineTools = new ArrayList<OnlineToolBean>();

    try {
        onlineTools = this.getJdbcTemplateReader().query(this.getSQL().getValue("onlineTool/loadAll"),
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadOnlineTool(rs);
                    }
                });

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

    return onlineTools;
}

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

/**
 * Used to load a CreditBean with a specific GUID and supplied load options.
 *
 * @param guid the guid/*  w w w .j  a  va  2 s. co  m*/
 * @param loadDetails the load details
 *
 * @return the credit bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final CreditBean loadGUID(final int guid, final BuilderBean loadDetails) throws WhichDoctorDaoException {

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

    CreditBean credit = null;

    final String loadSQL = getSQL().getValue("credit/load") + " AND credit.GUID = ? AND credit.Active = true";

    try {
        credit = (CreditBean) this.getJdbcTemplateReader().queryForObject(loadSQL, new Object[] { guid },
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadCredit(rs, loadDetails);
                    }
                });

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

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

/**
 * Used to load a CreditBean with a specific name and supplied load options.
 *
 * @param strCredit the str credit/*www . j a v  a  2  s .c  om*/
 * @param loadDetails the load details
 *
 * @return the credit bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final CreditBean load(final String strCredit, final BuilderBean loadDetails)
        throws WhichDoctorDaoException {

    dataLogger.info("Credit Name: " + strCredit + " requested");

    int creditGUID = 0;

    final String loadSQL = getSQL().getValue("credit/loadName");

    try {
        creditGUID = this.getJdbcTemplateReader().queryForInt(loadSQL, new Object[] { strCredit });

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

    if (creditGUID > 0) {
        return loadGUID(creditGUID, loadDetails);
    } else {
        throw new WhichDoctorDaoException("Sorry no credit matching those " + "details could be identified");
    }
}

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

/**
 * Load.//w w  w.  jav a  2 s  .c  o  m
 *
 * @param guid the guid
 * @param type the type
 *
 * @return the collection< which doctor bean>
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<WhichDoctorBean> load(final int guid, final String type)
        throws WhichDoctorDaoException {
    if (type == null) {
        throw new NullPointerException("The type parameter cannot be null");
    }

    dataLogger.info("History of GUID: " + guid + " requested");

    String loadSQL = getSQL().getValue("whichdoctor/load/person");

    if (type.compareToIgnoreCase("organisation") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/organisation");
    }
    if (type.compareToIgnoreCase("debit") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/debit");
    }
    if (type.compareToIgnoreCase("credit") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/credit");
    }
    if (type.compareToIgnoreCase("receipt") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/receipt");
    }
    if (type.compareToIgnoreCase("reimbursement") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/reimbursement");
    }
    if (type.compareToIgnoreCase("rotation") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/rotation");
    }
    if (type.compareToIgnoreCase("group") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/group");
    }

    Collection<WhichDoctorBean> history = new ArrayList<WhichDoctorBean>();

    try {
        history = this.getJdbcTemplateReader().query(loadSQL, new Object[] { guid }, new RowMapper() {
            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                WhichDoctorBean loadedHistory = loadHistory(rs);
                loadedHistory.setObjectType(type);

                return loadedHistory;
            }
        });

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

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

/**
 * Used to load a CreditBean with a specific name and supplied load options.
 * A boolean parameter identifies whether to use the default reader
 * connection or optional writer connection datasource.
 *
 * @param creditId the credit id/*from w  ww  . j  a va 2 s  . c o m*/
 * @param loadDetails the load details
 * @param useWriter the use writer
 *
 * @return the credit bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
private CreditBean load(final int creditId, final BuilderBean loadDetails, final boolean useWriter)
        throws WhichDoctorDaoException {

    CreditBean credit = null;

    dataLogger.info("Credit Id: " + creditId + " requested");

    final String loadSQL = getSQL().getValue("credit/load") + " AND credit.CreditId = ?";

    JdbcTemplate jdbcTemplate = this.getJdbcTemplateReader();
    if (useWriter) {
        jdbcTemplate = this.getJdbcTemplateWriter();
    }

    try {
        credit = (CreditBean) jdbcTemplate.queryForObject(loadSQL, new Object[] { creditId }, new RowMapper() {
            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                return loadCredit(rs, loadDetails);
            }
        });

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

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

/**
 * Used to get a ReceiptBean for a specified guid and supplied load details.
 *
 * @param guid the guid//from w  w  w.ja  v  a  2s.c o m
 * @param loadDetails the load details
 *
 * @return the receipt bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final ReceiptBean loadGUID(final int guid, final BuilderBean loadDetails)
        throws WhichDoctorDaoException {

    ReceiptBean receipt = null;

    final String loadSQL = getSQL().getValue("receipt/load")
            + " AND receipt.Active = true AND receipt.GUID = ? " + "GROUP BY receipt.ReceiptId";

    try {
        receipt = (ReceiptBean) this.getJdbcTemplateReader().queryForObject(loadSQL, new Object[] { guid },
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadReceipt(rs, loadDetails);
                    }
                });

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

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

/**
 * Used to get a ReceiptBean for a specified name and supplied load details.
 *
 * @param strReceipt the str receipt/*from  w ww  . j a v  a2  s . c  om*/
 * @param loadDetails the load details
 *
 * @return the receipt bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final ReceiptBean load(final String strReceipt, final BuilderBean loadDetails)
        throws WhichDoctorDaoException {

    dataLogger.info("Receipt Name: " + strReceipt + " requested");

    int receiptGUID = 0;

    final String loadSQL = getSQL().getValue("receipt/loadName");

    try {
        receiptGUID = this.getJdbcTemplateReader().queryForInt(loadSQL, new Object[] { strReceipt });

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

    if (receiptGUID > 0) {
        return loadGUID(receiptGUID, loadDetails);
    } else {
        throw new WhichDoctorDaoException("Sorry no receipt matching " + "those details could be identified");
    }
}

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

/**
 * Used to get a ReceiptBean for a specified receiptId and supplied load
 * options. A boolean parameter identifies whether to use the default reader
 * connection or optional writer connection datasource.
 *
 * @param receiptId the receipt id/*from   w w w.  j a  va 2 s  .  c o m*/
 * @param loadDetails the load details
 * @param useWriterConn the use writer conn
 *
 * @return the receipt bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
private ReceiptBean load(final int receiptId, final BuilderBean loadDetails, final boolean useWriterConn)
        throws WhichDoctorDaoException {

    ReceiptBean receipt = null;

    final String loadSQL = getSQL().getValue("receipt/load")
            + " AND receipt.ReceiptId = ? GROUP BY receipt.ReceiptId";

    JdbcTemplate jdbcTemplate = this.getJdbcTemplateReader();

    if (useWriterConn) {
        jdbcTemplate = this.getJdbcTemplateWriter();
    }

    try {
        receipt = (ReceiptBean) jdbcTemplate.queryForObject(loadSQL, new Object[] { receiptId },
                new RowMapper() {

                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadReceipt(rs, loadDetails);
                    }
                });

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