Example usage for org.springframework.dao DataAccessException getMessage

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

Introduction

In this page you can find the example usage for org.springframework.dao DataAccessException 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:org.esco.portlets.news.dao.iBatis.EntityDAOImpl.java

/**
 * Supprime le lien entre une entit et une liste de type.
 * @param typeIds/*ww  w . jav  a 2  s.co m*/
 * @param entityId
 * @throws DataAccessException
 * @see org.esco.portlets.news.dao.EntityDAO#deleteAuthorizedTypesToEntity(java.util.List, java.lang.Long)
 */
public void deleteAuthorizedTypesToEntity(final List<Long> typeIds, final Long entityId)
        throws DataAccessException {
    for (Long tId : typeIds) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(NewsConstants.TYPE_ID, tId);
        params.put(NewsConstants.ENTITY_ID, entityId);
        try {
            getSqlMapClientTemplate().delete("deleteOneAuthorizedTypeOnEntity", params);
        } catch (DataAccessException e) {
            LOG.warn("EntityDaoImpl:: deleteOneAuthorizedTypeOnEntity : Error : " + e.getMessage());
            throw e;
        }
    }
}

From source file:org.esco.portlets.news.dao.iBatis.FilterDAOImpl.java

/**
 * Add search filters to the entity./*w w  w.  j  a  va 2  s . c  o  m*/
 * @param filter A list of filters.
 * @throws DataAccessException
 */
public void saveFilterOfEntity(final Filter filter) throws DataAccessException {
    try {
        if (filter.getFilterId() == null || filter.getFilterId() < 1) {
            getSqlMapClientTemplate().insert("insertFilterOfEntity", filter);
        } else {
            getSqlMapClientTemplate().insert("updateFilterById", filter);
        }
    } catch (DataAccessException e) {
        LOG.warn("EntityDaoImpl:: insertFilterOfEntity : Error : " + e.getMessage());
        throw e;
    }
}

From source file:org.esco.portlets.news.dao.iBatis.FilterDAOImpl.java

/**
 * Delete all Filters of an Entity.//from   w w  w .  j  a  va2s  . c om
 * @param entityId The entity id.
 * @throws DataAccessException
 */
public void deleteAllFiltersOfEntity(final Long entityId) throws DataAccessException {
    try {
        getSqlMapClientTemplate().delete("deleteAllFilterOnEntity", entityId);
    } catch (DataAccessException e) {
        LOG.warn("EntityDaoImpl:: deleteAllFiltersOfEntity : Error : " + e.getMessage());
        throw e;
    }
}

From source file:org.esco.portlets.news.dao.iBatis.FilterDAOImpl.java

/**
 * Delete a Filter of an Entity.//  w w w  . j  a v  a 2  s.  c  o  m
 * @param filterId The filter id.
 * @param entityId The entity id.
 * @return <code>boolean</code>
 * @throws DataAccessException
 */
public boolean deleteFilterOfEntity(final Long filterId, final Long entityId) throws DataAccessException {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put(NewsConstants.FILTER_ID, filterId);
    params.put(NewsConstants.ENTITY_ID, entityId);
    try {
        return getSqlMapClientTemplate().delete("deleteFilterOnEntity", params) == 1;
    } catch (DataAccessException e) {
        LOG.warn("EntityDaoImpl:: deleteFilterOnEntity : Error : " + e.getMessage());
        throw e;
    }
}

From source file:org.esco.portlets.news.dao.iBatis.TypeDAOImpl.java

/**
 * Lie des entits  un type.//from ww  w  .j  ava  2s .  co m
 * @param typeId
 * @param entitiesIds
 * @throws DataAccessException
 * @see org.esco.portlets.news.dao.TypeDAO#addEntitiesToType(java.lang.Long, java.util.List)
 */
public void addEntitiesToType(final Long typeId, final List<Long> entitiesIds) throws DataAccessException {
    for (Long eId : entitiesIds) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(NewsConstants.TYPE_ID, typeId);
        params.put(NewsConstants.ENTITY_ID, eId);
        try {
            getSqlMapClientTemplate().insert("insertOneAuthorizedTypeOfEntity", params);
        } catch (DataAccessException e) {
            LOG.warn("TypeDaoImpl:: insertOneAuthorizedTypeOfEntity : Error : " + e.getMessage());
            throw e;
        }
    }
}

From source file:org.esco.portlets.news.dao.iBatis.TypeDAOImpl.java

/**
 * Supprime le lien entre une liste d'entit et un type.
 * @param typeId/*from  w  ww . j av a2  s . c  om*/
 * @param entitiesIds
 * @throws DataAccessException
 * @see org.esco.portlets.news.dao.TypeDAO#deleteEntitiesToType(java.lang.Long, java.util.List)
 */
public void deleteEntitiesToType(final Long typeId, final List<Long> entitiesIds) throws DataAccessException {
    for (Long eId : entitiesIds) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(NewsConstants.TYPE_ID, typeId);
        params.put(NewsConstants.ENTITY_ID, eId);
        try {
            getSqlMapClientTemplate().delete("deleteOneAuthorizedTypeOnEntity", params);
        } catch (DataAccessException e) {
            LOG.warn("TypeDaoImpl:: deleteOneAuthorizedTypeOnEntity : Error : " + e.getMessage());
            throw e;
        }
    }
}

From source file:org.esco.portlets.news.services.UserManagerImpl.java

/**
 * @param uid/*from   w ww.  j a v  a2s  .c  o m*/
 * @param enabled
 * @see org.esco.portlets.news.services.UserManager#updateUserStatus(java.lang.String, java.lang.String)
 */
@Transactional(propagation = Propagation.REQUIRED)
public void updateUserStatus(final String uid, final String enabled) {
    try {
        this.userDao.updateUserStatus(uid, enabled);
    } catch (DataAccessException e) {
        LOG.error("updateUserStatus error : " + e.getMessage());
        throw e;
    }
}

From source file:org.esco.portlets.news.services.UserManagerImpl.java

/**
 * @param uid//from   www.j  a  v a  2  s  .  c om
 * @see org.esco.portlets.news.services.UserManager#updateUserLastAccess(java.lang.String)
 */
@Transactional(propagation = Propagation.REQUIRED)
public void updateUserLastAccess(final String uid) {
    try {
        this.userDao.updateUserLastAccess(uid);
    } catch (DataAccessException e) {
        LOG.error("updateUserLastAccess error : " + e.getMessage());
        throw e;
    }
}

From source file:org.esco.portlets.news.services.UserManagerImpl.java

/**
 * @param uid/* ww  w .  ja v  a  2 s.  c  o  m*/
 * @see org.esco.portlets.news.services.UserManager#deleteUser(java.lang.String)
 */
@Transactional(propagation = Propagation.REQUIRED)
public void deleteUser(final String uid) {
    try {
        userDao.deleteUser(uid, true);
    } catch (DataAccessException e) {
        if (LOG.isWarnEnabled()) {
            LOG.warn("deleteUser:: data access error :" + e.getMessage());
        }
        throw e;
    }
}

From source file:org.hyperic.hq.measurement.server.session.DataCompressionDAO.java

public void truncateMeasurementData(long truncateBefore) {
    // we can't get any accurate metric tablenames if truncateBefore
    // is less than the base point in time which is used for the
    // tablename calculations
    if (truncateBefore < MeasTabManagerUtil.getBaseTime()) {
        return;// w  w  w  .  j ava2 s . com
    }
    long currtime = System.currentTimeMillis();
    String currTable = MeasTabManagerUtil.getMeasTabname(currtime);
    long currTruncTime = truncateBefore;
    // just in case truncateBefore is in the middle of a table
    currTruncTime = MeasTabManagerUtil.getPrevMeasTabTime(currTruncTime);
    String delTable = MeasTabManagerUtil.getMeasTabname(currTruncTime);
    if (delTable.equals(currTable)) {
        currTruncTime = MeasTabManagerUtil.getPrevMeasTabTime(currTruncTime);
        delTable = MeasTabManagerUtil.getMeasTabname(currTruncTime);
    }
    log.debug("Truncating tables, starting with -> " + delTable + " (currTable -> " + currTable + ")\n");
    HQDialect dialect = (HQDialect) ((SessionFactoryImplementor) sessionFactory).getDialect();
    while (!currTable.equals(delTable) && truncateBefore > currTruncTime) {
        try {
            log.debug("Truncating table " + delTable);
            jdbcTemplate.execute("truncate table " + delTable);
            String sql = dialect.getOptimizeStmt(delTable, 0);
            jdbcTemplate.execute(sql);
        } catch (DataAccessException e) {
            log.error(e.getMessage(), e);
        } finally {
            currTruncTime = MeasTabManagerUtil.getPrevMeasTabTime(currTruncTime);
            delTable = MeasTabManagerUtil.getMeasTabname(currTruncTime);
        }
    }
}