List of usage examples for org.springframework.dao DataAccessException getMostSpecificCause
public Throwable getMostSpecificCause()
From source file:org.mifosplatform.portfolio.savings.service.SavingsProductWritePlatformServiceJpaRepositoryImpl.java
private void handleDataIntegrityIssues(final JsonCommand command, final DataAccessException dae) { final Throwable realCause = dae.getMostSpecificCause(); if (realCause.getMessage().contains("sp_unq_name")) { final String name = command.stringValueOfParameterNamed("name"); throw new PlatformDataIntegrityException("error.msg.product.savings.duplicate.name", "Savings product with name `" + name + "` already exists", "name", name); } else if (realCause.getMessage().contains("sp_unq_short_name")) { final String shortName = command.stringValueOfParameterNamed("shortName"); throw new PlatformDataIntegrityException("error.msg.product.savings.duplicate.short.name", "Savings product with short name `" + shortName + "` already exists", "shortName", shortName); }//from ww w . ja v a 2 s . com logAsErrorUnexpectedDataIntegrityException(dae); throw new PlatformDataIntegrityException("error.msg.savingsproduct.unknown.data.integrity.issue", "Unknown data integrity issue with resource."); }