Select MyBatis-style SQL maps at runtime by DBMS + version with graceful fallback to a default supported version
When monitoring or querying many RDBMS products across many versions (Oracle 9i–23c, MySQL 5.7–9.6, MariaDB 10.6–12.2, PostgreSQL 9.6–18, MSSQL 2012–2022, Tibero 4–6, CUBRID 9.1–11.3), maintain one SQL map XML per (DBMS, majorVersion) tuple and resolve the correct map at runtime.
sql_map_<DBMS>_<VERSION>.xml in a single resources folder.Map<(dbms,version), Map<queryId, sql>>.getQuery(dbms, rawVersion, queryId) runs rawVersion through a per-DBMS version normalizer, then falls back to a known-good default when the normalizer rejects it.DbmsVersionResolver interface: String resolve(String rawVersion); one impl per DBMS.10.x, 11.x, 12.x → ; unknown → documented default).12cMap<Dbms, DbmsVersionResolver>.sql_map_*.xml and parse (dbms, version) from the filename; store in a two-level map.QueryTextMapper.get(dbms, rawVersion, queryId) that resolves version, looks up, and throws only when the query id is missing for every known version of that DBMS.(dbms→version) once per target on first use so operators can see which bucket a target was routed to.