use of org.springframework.dao.NonTransientDataAccessResourceException in project ORCID-Source by ORCID.
the class FundingSubtypeSolrDaoImpl method persist.
@Override
public void persist(OrgDefinedFundingTypeSolrDocument fundingType) {
try {
solrServer.addBean(fundingType);
solrServer.commit();
} catch (SolrServerException se) {
throw new NonTransientDataAccessResourceException("Error persisting funding type to SOLR Server", se);
} catch (IOException ioe) {
throw new NonTransientDataAccessResourceException("IOException when persisting funding type to SOLR", ioe);
}
}
use of org.springframework.dao.NonTransientDataAccessResourceException in project ORCID-Source by ORCID.
the class SolrIndexUpdater method persist.
public void persist(OrcidSolrDocument orcidSolrDocument) {
try {
solrServer.addBean(orcidSolrDocument);
solrServer.commit();
} catch (SolrServerException se) {
throw new NonTransientDataAccessResourceException("Error persisting to SOLR Server", se);
} catch (IOException ioe) {
throw new NonTransientDataAccessResourceException("IOException when persisting to SOLR", ioe);
}
}
use of org.springframework.dao.NonTransientDataAccessResourceException in project ORCID-Source by ORCID.
the class OrgDisambiguatedSolrDaoImpl method persist.
@Override
public void persist(OrgDisambiguatedSolrDocument orgDisambiguatedSolrDocument) {
try {
solrServer.addBean(orgDisambiguatedSolrDocument);
solrServer.commit();
} catch (SolrServerException se) {
throw new NonTransientDataAccessResourceException("Error persisting org to SOLR Server", se);
} catch (IOException ioe) {
throw new NonTransientDataAccessResourceException("IOException when persisting org to SOLR", ioe);
}
}
use of org.springframework.dao.NonTransientDataAccessResourceException in project uPortal by Jasig.
the class HibernateDbLoader method process.
@Override
public void process(DbLoaderConfig configuration) throws ParserConfigurationException, SAXException, IOException {
final String scriptFile = configuration.getScriptFile();
final List<String> script;
if (scriptFile == null) {
script = null;
} else {
script = new LinkedList<String>();
}
final ITableDataProvider tableData = this.loadTables(configuration, dialect);
//Handle table drop/create
if (configuration.isDropTables() || configuration.isCreateTables()) {
//Load Table object model
final Map<String, Table> tables = tableData.getTables();
final Mapping mapping = this.configuration.buildMapping();
final String defaultCatalog = this.configuration.getProperty(Environment.DEFAULT_CATALOG);
final String defaultSchema = this.configuration.getProperty(Environment.DEFAULT_SCHEMA);
final Map<String, DataAccessException> failedSql = new LinkedHashMap<String, DataAccessException>();
//Generate and execute drop table scripts
if (configuration.isDropTables()) {
final List<String> dropScript = this.dropScript(tables.values(), dialect, defaultCatalog, defaultSchema);
if (script == null) {
this.logger.info("Dropping existing tables");
for (final String sql : dropScript) {
this.logger.info(sql);
try {
jdbcOperations.update(sql);
} catch (NonTransientDataAccessResourceException dae) {
throw dae;
} catch (DataAccessException dae) {
failedSql.put(sql, dae);
}
}
} else {
script.addAll(dropScript);
}
}
//Log any drop/create statements that failed
for (final Map.Entry<String, DataAccessException> failedSqlEntry : failedSql.entrySet()) {
this.logger.warn("'" + failedSqlEntry.getKey() + "' failed to execute due to " + failedSqlEntry.getValue());
}
//Generate and execute create table scripts
if (configuration.isCreateTables()) {
final List<String> createScript = this.createScript(tables.values(), dialect, mapping, defaultCatalog, defaultSchema);
if (script == null) {
this.logger.info("Creating tables");
for (final String sql : createScript) {
this.logger.info(sql);
jdbcOperations.update(sql);
}
} else {
script.addAll(createScript);
}
}
}
//Perform database population
if (script == null && configuration.isPopulateTables()) {
this.logger.info("Populating database");
final Map<String, Map<String, Integer>> tableColumnTypes = tableData.getTableColumnTypes();
this.populateTables(configuration, tableColumnTypes);
}
//Write out the script file
if (script != null) {
for (final ListIterator<String> iterator = script.listIterator(); iterator.hasNext(); ) {
final String sql = iterator.next();
iterator.set(sql + ";");
}
final File outputFile = new File(scriptFile);
FileUtils.writeLines(outputFile, script);
this.logger.info("Saved DDL to: " + outputFile.getAbsolutePath());
}
}
Aggregations