use of org.apereo.portal.hibernate.DelegatingHibernateIntegrator.HibernateConfiguration in project uPortal by Jasig.
the class DbTestImpl method printDbInfo.
@Override
public void printDbInfo() {
boolean fail = false;
logger.info("JDBC DataSources");
for (final Entry<String, JdbcOperations> jdbcEntry : this.jdbcOperations.entrySet()) {
final String jdbcName = jdbcEntry.getKey();
try {
logger.info("\t" + jdbcName);
final JdbcOperations jdbcOps = jdbcEntry.getValue();
jdbcOps.execute(new ConnectionCallback<Object>() {
@Override
public Object doInConnection(Connection con) throws SQLException, DataAccessException {
printInfo(con);
return null;
}
});
} catch (Exception e) {
logger.error("\t" + jdbcName + ": parse info", e);
fail = true;
}
logger.info("");
}
logger.info("Hibernate Dialects");
for (final Entry<String, HibernateConfiguration> configEntry : this.hibernateConfigurations.entrySet()) {
final String persistenceUnit = configEntry.getKey();
try {
final HibernateConfiguration hibernateConfiguration = configEntry.getValue();
final SessionFactoryImplementor sessionFactory = hibernateConfiguration.getSessionFactory();
final Dialect dialect = sessionFactory.getDialect();
logger.info("\t" + persistenceUnit + ": " + dialect);
} catch (Exception e) {
logger.error("\t" + persistenceUnit + ": Failed to resolve Dialect", e);
fail = true;
}
logger.info("");
}
if (fail) {
throw new RuntimeException("One or more of the portal data sources is not configured correctly or the target database is not available.");
}
}
Aggregations