class DerbyPagingQueryProvider extends SqlWindowingPagingQueryProvider {

	private static final String MINIMAL_DERBY_VERSION = "10.4.1.3";

	@Override
	public void init(DataSource dataSource) throws Exception {<FILL_FUNCTION_BODY>}

	// derby version numbering is M.m.f.p [ {alpha|beta} ] see
	// https://db.apache.org/derby/papers/versionupgrade.html#Basic+Numbering+Scheme
	private boolean isDerbyVersionSupported(String version) {
		String[] minimalVersionParts = MINIMAL_DERBY_VERSION.split("\\.");
		String[] versionParts = version.split("[\\. ]");
		for (int i = 0; i < minimalVersionParts.length; i++) {
			int minimalVersionPart = Integer.parseInt(minimalVersionParts[i]);
			int versionPart = Integer.parseInt(versionParts[i]);
			if (versionPart < minimalVersionPart) {
				return false;
			}
			else if (versionPart > minimalVersionPart) {
				return true;
			}
		}
		return true;
	}

	@Override
	protected String getOrderedQueryAlias() {
		return "TMP_ORDERED";
	}

	@Override
	protected String getOverClause() {
		return "";
	}

	@Override
	protected String getOverSubstituteClauseStart() {
		return " FROM (SELECT " + getSelectClause();
	}

	@Override
	protected String getOverSubstituteClauseEnd() {
		return " ) AS " + getOrderedQueryAlias();
	}

}

		super.init(dataSource);
		String version = JdbcUtils.extractDatabaseMetaData(dataSource, DatabaseMetaData::getDatabaseProductVersion);
		if (!isDerbyVersionSupported(version)) {
			throw new InvalidDataAccessResourceUsageException(
					"Apache Derby version " + version + " is not supported by this class,  Only version "
							+ MINIMAL_DERBY_VERSION + " or later is supported");
		}
	
<methods>public non-sealed void <init>() ,public java.lang.String generateFirstPageQuery(int) ,public java.lang.String generateRemainingPagesQuery(int) <variables>