-
Notifications
You must be signed in to change notification settings - Fork 9
Model Notes
All bound result classes implement MetadataType, which extends Serializable.
Map<String, Object> unknownColumns = value.getUnknownColumns();getUnknownColumns() records result-set columns returned by a JDBC driver that do not have a mapped field in the model class. This is useful because drivers sometimes expose vendor-specific metadata columns or differ across versions.
Context binds rows by:
- reading the result-set column labels;
- finding fields annotated with the internal
_ColumnLabelannotation; - assigning result values by label;
- storing unmapped result-set columns in
MetadataType.getUnknownColumns().
Mapped fields are exposed through typed getters such as Table.getTableName(), Column.getDataType(), and PrimaryKey.getKeySeq().
The package is annotated with JSpecify @NullMarked, and nullable JDBC values are explicitly marked in source with @Nullable.
Practical implications:
- catalog and schema values may be
null; - optional remarks, default values, generated-column flags, and driver-dependent metadata may be
null; - JDBC integer and boolean values are exposed as wrapper types where a database or driver may report SQL
NULL.
The source contains internal relationship annotations that document how metadata records relate to each other.
| Parent | Children |
|---|---|
Catalog |
Schema, Table, TablePrivilege, Procedure, SuperTable, SuperType
|
Schema |
Table, TablePrivilege, Procedure, SuperTable, SuperType
|
Table |
Column, ColumnPrivilege, PrimaryKey, ImportedKey, ExportedKey, CrossReference, IndexInfo, TablePrivilege, BestRowIdentifier, VersionColumn, PseudoColumn
|
Column |
ColumnPrivilege |
Procedure |
ProcedureColumn |
Function |
FunctionColumn |
UDT |
Attribute, SuperType
|
Some result types are root-like and not children of another metadata type, including Catalog, TableType, and TypeInfo.
Most JDBC metadata methods define an expected order for their result sets. Context preserves the order returned by the JDBC driver. Some model classes also contain comparator helpers for ordering records in the specification's expected order when driver behavior needs to be checked or normalized.
Known driver ordering and duplicate issues are tracked from the repository README:
- MariaDB: table ordering, function ordering, and client-info property ordering issues are linked.
- MySQL: duplicate table rows from
DatabaseMetaData#getTablesare linked. - PostgreSQL: duplicate function-column rows are linked.
- SQL Server: procedure ordering issue is linked.
The library does not create schemas, introspect SQL text, or normalize database products into a single metadata dialect. It keeps JDBC metadata visible as typed Java records while preserving JDBC driver behavior.