resultRowType

Talks about: , and

The fully-qualified name of a record to build each result row into

Name a record and YoSQL writes the converter for you. It reads the record’s canonical constructor out of its source file — under sourceDirectory — and emits one resultSet.getX(...) call per component, in a class of its own. No reflection is involved at any point, so the result survives a GraalVM native image intact.

A component takes its column from its own name, camelCase read as snake_case: tenantId reads the tenant_id column. When a column is named something else, alias it in the SQL — select amount_cents as minor_units — which keeps the mapping next to the query that produces it.

Components whose own type is a record are built from the same flat row: nesting groups values on the Java side and the query knows nothing about it, so a nested component claims the column matching its own name, not a prefixed one.

A type the generator cannot otherwise read works if it says how: a static factory called valueOf, taking one value the generator does know, is called with the column’s value. That is the same convention enums follow, and it is what makes a one-component record a value wrapped around a column rather than a nesting.

A column no component claims, or a component no column supplies, fails the build and names the file, the statement and the component.

Configuration Options

Front Matter

In order to configure this option, place the following code in the front matter of your SQL statement:

-- resultRowType: configValue
SELECT  something
FROM    your_database_schema
WHERE   some_column = :some_value