use of uk.gov.justice.services.eventsourcing.repository.jdbc.exception.InvalidStreamIdException in project microservice_framework by CJSCommonPlatform.
the class EventStreamJdbcRepository method getPosition.
public long getPosition(final UUID streamId) {
try (final PreparedStatementWrapper psquery = eventStreamJdbcRepositoryHelper.preparedStatementWrapperOf(dataSource, SQL_FIND_POSITION_BY_STREAM)) {
psquery.setObject(1, streamId);
ResultSet resultSet = psquery.executeQuery();
if (resultSet.next()) {
return resultSet.getLong(1);
}
throw new InvalidStreamIdException("Invalid Stream Id: " + streamId.toString());
} catch (final SQLException e) {
throw new JdbcRepositoryException(format(EVENT_STREAM_EXCEPTION_MESSAGE, streamId), e);
}
}
Aggregations