Example usage for org.springframework.dao DataAccessException printStackTrace

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

Introduction

In this page you can find the example usage for org.springframework.dao DataAccessException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.aquest.emailmarketing.web.controllers.ErrorHandler.java

/**
 * Handle database exception./*from   ww  w . j  a  va  2s  .c o m*/
 *
 * @param ex the ex
 * @return the string
 */
@ExceptionHandler(DataAccessException.class)
public String handleDatabaseException(DataAccessException ex) {
    ex.printStackTrace();
    return "error";
}

From source file:com.persistent.cloudninja.dao.impl.RolesDaoImpl.java

@SuppressWarnings("unchecked")
@Override/*from w  w  w . j a v a 2  s .c  o m*/
public List<Role> getRolesForUser() {

    List<Role> roleList = null;
    try {

        roleList = hibernateTemplate.find("from Role");

    } catch (DataAccessException exception) {
        exception.printStackTrace();
    }
    return roleList;
}

From source file:org.fornax.cartridges.sculptor.smartclient.server.util.SculptorUserDetailProvider.java

public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
    SculptorUserDetail retVal = null;//from w w  w.  ja  v a 2s  .com
    try {
        Users findUser = usersService.findUser(null, username);
        if (findUser != null) {
            retVal = new SculptorUserDetail(findUser.getUsername(), findUser.getPassword(), findUser.getRoles(),
                    findUser.isEnabled(), (Calendar.getInstance()).after(findUser.getExpireAt()),
                    findUser.getSelectedLanguage().getValue());
        }
    } catch (UsernameNotFoundException unfe) {
        unfe.printStackTrace();
        throw unfe;
    } catch (DataAccessException dae) {
        dae.printStackTrace();
        throw dae;
    } catch (Throwable th) {
        th.printStackTrace();
        throw new UsernameNotFoundException("Error when resolving user '" + username + "'", th);
    }

    return retVal;
}

From source file:com.tt.utils.DBUtils.java

public int getLicenseeInfo() {
    int id = -9999;
    Map<String, String> params = new HashMap<String, String>();
    params.put("AccessToken", System.getProperty(ACCESS_TOKEN, "default"));
    try {//w ww.j a v a 2s .  c om
        id = simplejdbcTemplate.queryForInt(DBQueryMap.getQueryString(DBQueryMap.GET_ACCESS_ID), params);
    } catch (DataAccessException e) {
        e.printStackTrace();
    }

    return id;
}

From source file:com.tt.utils.DBUtils.java

public int getLocationInfo(SearchCriteria sc) {
    int id = -9999;
    Map<String, String> params = new HashMap<String, String>();
    params.put("licenseeId", new Integer(sc.getLicenseeId()).toString());
    params.put("locationExternalId", sc.getLocationExternalId());
    try {//from  www  .j a  v  a2s.com
        id = simplejdbcTemplate.queryForInt(DBQueryMap.getQueryString(DBQueryMap.GET_LOCATION_INFO), params);
    } catch (DataAccessException e) {
        e.printStackTrace();
    }

    return id;
}

From source file:com.gigaspaces.blueprint.frauddetection.processor.UserCheckValidation.java

@SpaceDataEvent
public void validateUser(UserPaymentMsg event, GigaSpace gigaSpace) {

    try {/*from   www.  ja  v a  2 s.com*/
        //get the latest copy of user data
        User user = gigaSpace.readById(User.class, event.getUserId(), null, 0, ReadModifiers.READ_COMMITTED);
        //get the latest copy of cards details
        Card cardTemplate = new Card();
        cardTemplate.setUserId(event.getUserId());
        Card[] cards = gigaSpace.readMultiple(cardTemplate, Integer.MAX_VALUE, ReadModifiers.READ_COMMITTED);
        //get all transaction for this user
        Payment paymentTemplate = new Payment();
        paymentTemplate.setUserId(event.getUserId());
        Payment[] payments = gigaSpace.readMultiple(paymentTemplate, Integer.MAX_VALUE,
                ReadModifiers.READ_COMMITTED);

        IdQuery<PaymentAuthorization> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthorization.class,
                event.getPaymentId());

        Boolean paymentValid = AuthorizeUserData(user, cards, payments);

        gigaSpace.change(idQuery, new ChangeSet().set("userCheck", paymentValid));

    } catch (DataAccessException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }

}

From source file:org.atmars.action.CheckEmailAction.java

@Override
public String execute() {
    InitAction();//from  w  w w.  j  a v  a 2s  . co  m
    User u = uService.getUserInfoByEmail(email);

    try {
        if (jMail.checkLink(u.getEmail(), u.getNickname(), u.getTime(), ticket)) {
            u.setConfirm(true);
            uService.updateUserInfo(u);
            Map session = ActionContext.getContext().getSession();
            session.put("user", u);
            return "confirm_success";
        } else {
            uService.deleteUser(u);
            return "confirm_fail";
        }
    } catch (DataAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return "error";
}

From source file:net.noday.core.dao.AppDao.java

public App getAppConfig() {
    List<String> tables = jdbc.queryForList("show tables", String.class);
    Connection conn = DataSourceUtils.getConnection(jdbc.getDataSource());
    try {/*from   ww  w  .j  ava2 s  .c  om*/
        conn.setAutoCommit(false);
        if (tables == null || tables.size() == 0 || !tables.contains("app_config")) {
            initDB();
        } else {
            String version = jdbc.queryForObject("select a.version from app_config a limit 1", String.class);
            if (!"1.1".equalsIgnoreCase(version)) {
                updateDB("1_1");
            }
        }
        conn.commit();
    } catch (DataAccessException e) {
        e.printStackTrace();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    String sql = "select * from app_config limit 1";
    App cfg = jdbc.queryForObject(sql, new BeanPropertyRowMapper<App>(App.class));
    if (cfg == null) {
        throw new AppStartupException("??");
    }
    return cfg;
}

From source file:architecture.ee.web.community.profile.dao.jdbc.JdbcProfileDao.java

public ProfileImage getProfileImageById(Long profileImageId) throws ProfileImageNotFoundException {
    try {/*from   ww w .j  a  v  a 2s  .c  o m*/
        return getExtendedJdbcTemplate().queryForObject(
                getBoundSql("ARCHITECTURE_COMMUNITY.SELECT_PROFILE_IMAGE_BY_ID").getSql(), imageMapper,
                new SqlParameterValue(Types.NUMERIC, profileImageId));
    } catch (DataAccessException e) {
        e.printStackTrace();
        throw new ProfileImageNotFoundException(e);
    }
}

From source file:sample.contact.web.AdminPermissionController.java

/**
 * Handles submission of the "add permission" form.
 *//*from www  . j a v a 2  s.  c o m*/
@RequestMapping(value = "/secure/addPermission.htm", method = RequestMethod.POST)
public String addPermission(AddPermission addPermission, BindingResult result, ModelMap model) {
    addPermissionValidator.validate(addPermission, result);

    if (result.hasErrors()) {
        model.put("recipients", listRecipients());
        model.put("permissions", listPermissions());

        return "addPermission";
    }

    PrincipalSid sid = new PrincipalSid(addPermission.getRecipient());
    Permission permission = permissionFactory.buildFromMask(addPermission.getPermission());

    try {
        contactService.addPermission(addPermission.getContact(), sid, permission);
    } catch (DataAccessException existingPermission) {
        existingPermission.printStackTrace();
        result.rejectValue("recipient", "err.recipientExistsForContact", "Addition failure.");

        model.put("recipients", listRecipients());
        model.put("permissions", listPermissions());
        return "addPermission";
    }

    return "redirect:/secure/index.htm";
}