Example usage for org.springframework.dao DataIntegrityViolationException getClass

List of usage examples for org.springframework.dao DataIntegrityViolationException getClass

Introduction

In this page you can find the example usage for org.springframework.dao DataIntegrityViolationException getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.poscoict.license.web.controller.ExceptionControllerAdvice.java

@ExceptionHandler(DataIntegrityViolationException.class)
public ModelAndView handleDataIntegrityViolationException(DataIntegrityViolationException ex) {
    logger.error(ex.toString());//from w  w w . j a v  a  2s  . c  om
    ModelAndView mv = new ModelAndView(DEFAULT_ERROR_VIEW);
    mv.addObject("name", ex.getClass().getSimpleName());
    mv.addObject("message",
            "?  ?. ?? ? . ?  ? ? ? ?  .");
    return mv;
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public boolean addAvailabilityCheck(AvailabilityCheck availabilityCheck) {
    if (log.isDebugEnabled()) {
        log.debug("addAvailabilityCheck( " + availabilityCheck.toString() + ")");
    }//from   w  w  w.ja v a 2s  .  co m

    // entity_ref, scheduled_time

    try {
        JdbcTemplate template = getJdbcTemplate();
        String sql = getStatement("insert.AvailabilityCheck");

        template.update(sql, new Object[] { availabilityCheck.getEntityReference(),
                availabilityCheck.getEntityTypeId(), availabilityCheck.getScheduledTime() });
        return true;
    } catch (DataIntegrityViolationException e) {
        // this means we're trying to insert a duplicate
        log.debug("addAvailabilityCheck() " + e);
        return false;
    } catch (DataAccessException ex) {
        log.warn("addAvailabilityCheck: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return false;
    } catch (Exception e) {
        log.warn("addAvailabilityCheck: Error executing query: " + e.getClass() + ":" + e.getMessage());
        return false;
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public boolean addContext(Context context) {
    if (log.isDebugEnabled()) {
        log.debug("addContext( " + context.toString() + ")");
    }//from  www.j a va 2s.c om

    //  context_id, context_url, context_title

    String sql = getStatement("insert.Context");
    try {
        int rows = getJdbcTemplate().update(sql,
                new Object[] { context.getContextId(), context.getContextUrl(), context.getContextTitle() });
        return true;
    } catch (DataIntegrityViolationException e) {
        // this means we're trying to insert a duplicate
        log.debug("addContext() " + e);
        return false;
    } catch (DataAccessException ex) {
        log.warn("addContext: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return false;
    } catch (Exception e) {
        log.warn("addCalendarItem: Error executing query: " + e.getClass() + ":" + e.getMessage());
        return false;
    }
}