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

/**
 * Used to ge an Collection of QualificationBean details for a specified GUID.
 *
 * @param guid the guid//from  www  . ja  v  a 2 s.  c  om
 * @param fullResults the full results
 * @return the collection
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<QualificationBean> load(final int guid, final boolean fullResults)
        throws WhichDoctorDaoException {

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

    final String loadQualifications = getSQL().getValue("qualification/load")
            + " WHERE qualification.Active = true AND qualification.ReferenceGUID = ?"
            + " ORDER BY qualification.Year ASC";

    Collection<QualificationBean> qualifications = new ArrayList<QualificationBean>();

    try {
        qualifications = this.getJdbcTemplateReader().query(loadQualifications, new Object[] { guid },
                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 qualifications;
}

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

/**
 * Load a GadgetBean based on its url.// w ww  .j  av  a 2  s .c om
 *
 * @param url the url
 *
 * @return the gadget bean
 *
 * @throws SFSDaoException the SFS dao exception
 */
public final GadgetBean load(final String url) throws SFSDaoException {

    GadgetBean gadgetBean = null;

    if (url == null) {
        throw new SFSDaoException("Error: URL cannot be null");
    }
    if (url.compareTo("") == 0) {
        throw new SFSDaoException("Error: URL cannot be an empty string");
    }

    dataLogger.debug("Load gadget for: " + url);

    try {
        gadgetBean = (GadgetBean) this.getJdbcTemplateReader()
                .queryForObject(this.getSQL().getValue("gadget/load"), new Object[] { url }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadGadget(rs);
                    }
                });

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

    return gadgetBean;
}

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

/**
 * Load a single FinancialTypeBean for the supplied id.
 *
 * @param financialTypeId the financial type id
 *
 * @return the financial type bean//from   w  w  w . jav  a2  s. c om
 *
 * @throws SFSDaoException the SFS dao exception
 */
public final FinancialTypeBean load(final int financialTypeId) throws SFSDaoException {
    if (financialTypeId == 0) {
        throw new SFSDaoException("FinancialTypeId value cannot be 0");
    }

    FinancialTypeBean financialTypeBean = null;

    try {
        financialTypeBean = (FinancialTypeBean) this.getJdbcTemplateReader().queryForObject(
                this.getSQL().getValue("financialType/loadId"), new Object[] { financialTypeId },
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadDetails(rs);
                    }
                });

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

    return financialTypeBean;
}

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

/**
 * Load the phone bean./*from   ww w  . j a  v a2s  .  c o  m*/
 *
 * @param phoneId the phone id
 * @return the phone bean
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final PhoneBean load(final int phoneId) throws WhichDoctorDaoException {

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

    final String loadPhoneId = getSQL().getValue("phone/load") + " WHERE phone.PhoneId = ?";

    PhoneBean phoneNumber = null;

    try {
        phoneNumber = (PhoneBean) this.getJdbcTemplateReader().queryForObject(loadPhoneId,
                new Object[] { phoneId }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadPhone(rs);
                    }
                });

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

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

/**
 * Load a collection of FinancialTypeBeans.
 *
 * @param type the type/*w ww. ja v a  2 s  .c om*/
 *
 * @return the collection< financial type bean>
 *
 * @throws SFSDaoException the SFS dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<FinancialTypeBean> load(final String type) throws SFSDaoException {
    if (type == null) {
        throw new SFSDaoException("Error: type cannot be null");
    }
    if (type.compareTo("") == 0) {
        throw new SFSDaoException("Error: type cannot be an empty string");
    }

    Collection<FinancialTypeBean> listItems = new ArrayList<FinancialTypeBean>();

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

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

    return listItems;
}

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

/**
 * Used to get an ArrayList of SpecialtyBeans for a specified GUID.
 *
 * @param specialtyId the specialty id/*from   www.j a v a2s.  c  o m*/
 * @return the specialty bean
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final SpecialtyBean load(final int specialtyId) throws WhichDoctorDaoException {

    dataLogger.info("SpecialtyId: " + specialtyId + " requested");

    final String loadSpecialtyId = getSQL().getValue("specialty/load") + " WHERE specialty.SpecialtyId = ?";

    SpecialtyBean specialty = null;

    try {
        specialty = (SpecialtyBean) this.getJdbcTemplateReader().queryForObject(loadSpecialtyId,
                new Object[] { specialtyId }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadSpecialty(rs);
                    }
                });

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

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

/**
 * Load a FinancialTypeBean for the supplied parameters.
 *
 * @param object the object/*  w  w  w  .  j  a v a2  s  . c o m*/
 * @param financialType the financial type
 * @param objectClass the object class
 *
 * @return the financial type bean
 *
 * @throws SFSDaoException the SFS dao exception
 */
public final FinancialTypeBean load(final String object, final String financialType, final String objectClass)
        throws SFSDaoException {
    if (object == null) {
        throw new SFSDaoException("Finance Object definition cannot be null");
    }
    if (financialType == null) {
        throw new SFSDaoException("Finance Type cannot be null");
    }
    if (objectClass == null) {
        throw new SFSDaoException("Finance Class canot be null");
    }

    FinancialTypeBean financialTypeBean = null;

    try {
        financialTypeBean = (FinancialTypeBean) this.getJdbcTemplateReader().queryForObject(
                this.getSQL().getValue("financialType/loadType"),
                new Object[] { object, financialType, objectClass }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadDetails(rs);
                    }
                });

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

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

/**
 * Used to get an ArrayList of SpecialtyBeans for a specified GUID.
 *
 * @param guid the guid//w  w  w . j  ava 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<SpecialtyBean> load(final int guid, final boolean fullResults)
        throws WhichDoctorDaoException {

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

    final String loadSpecialties = getSQL().getValue("specialty/load")
            + " WHERE specialty.Active = true AND specialty.ReferenceGUID = ?"
            + " ORDER BY trainingprogram.Class, trainingprogram.Name, guid.CreatedDate";

    Collection<SpecialtyBean> specialties = new ArrayList<SpecialtyBean>();

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

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

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

/**
 * Used to get a Collection of PhoneBeans for a specified GUID.
 *
 * @param guid the guid//www.  jav  a2 s . c  o m
 * @param allPhoneNumbers the all phone numbers
 * @return the collection
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<PhoneBean> load(final int guid, final boolean allPhoneNumbers)
        throws WhichDoctorDaoException {

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

    // Do check whether required results are light
    // (only primary) or full (all phone numbers)
    String loadPhone = this.getSQL().getValue("phone/load")
            + " WHERE phone.Active = true AND phone.ReferenceGUID = ?";
    if (!allPhoneNumbers) {
        loadPhone += " AND PrimaryPhone = true ORDER BY PrimaryPhone DESC";
    } else {
        loadPhone += " ORDER BY PrimaryPhone DESC";
    }

    Collection<PhoneBean> phoneNumbers = new ArrayList<PhoneBean>();

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

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

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

/**
 * Search for a list of Gadgets based on the supplied GadgetListBean parameters.
 *
 * @param gadgetList the gadget list/*from   w  ww .j av a2  s.c  om*/
 *
 * @return the gadget list bean
 *
 * @throws SFSDaoException the SFS dao exception
 */
@SuppressWarnings("unchecked")
public final GadgetListBean search(final GadgetListBean gadgetList) throws SFSDaoException {
    GadgetListBean results = gadgetList.clone();

    results.setCategories(this.getCategories());

    String category = "";
    if (gadgetList.getCategory().compareToIgnoreCase("All") != 0
            && gadgetList.getCategory().compareToIgnoreCase("Latest") != 0) {
        category = gadgetList.getCategory();
    }
    category += "%";

    String searchSQL = getSQL().getValue("gadget/search");
    if (gadgetList.getCategory().compareToIgnoreCase("Latest") == 0) {
        searchSQL += " ORDER BY gadgets.Created DESC LIMIT ?, ?";
    } else {
        searchSQL += " ORDER BY gadgets.Title ASC LIMIT ?, ?";
    }

    final String searchString = "%" + gadgetList.getSearchString() + "%";

    try {
        final int totalResults = this.getJdbcTemplateReader().queryForInt(getSQL().getValue("gadget/count"),
                new Object[] { searchString, searchString, category });

        results.setTotalResults(totalResults);

    } catch (DataAccessException de) {
        dataLogger.error("Error getting count: " + de.getMessage());
    }

    try {
        Collection<GadgetBean> gadgets = this
                .getJdbcTemplateReader().query(
                        searchSQL, new Object[] { searchString, searchString, category,
                                gadgetList.getCurrentRecord(), gadgetList.getResultsPerPage() },
                        new RowMapper() {
                            public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                                return loadGadget(rs);
                            }
                        });

        results.setResults(gadgets);

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