public ConnectionCache getConnectionCache(String databaseName, String preparedStatementText) throws DatabaseConfigException { ConfigurationDBRef config = mapDatabaseRef.get(databaseName); if (config == null) { throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\''); } DatabaseConnectionFactory connectionFactory = getConnectionFactory(databaseName); boolean retain = config.getConnectionLifecycleEnum().equals(ConfigurationDBRef.ConnectionLifecycleEnum.RETAIN); if (retain) { return new ConnectionCacheImpl(connectionFactory, preparedStatementText); } else { return new ConnectionNoCacheImpl(connectionFactory, preparedStatementText); } }