Summary
The README ("Auto-fetching @table types from database") states that when a service
field returns a @table type, Graphitron automatically fetches all requested
fields using the primary key from the service result:
The service needs to return a record with the primary key populated, all other
fields on the record are fetched from the database. […] For listed fields,
Graphitron extracts primary keys from all service results and performs a single
batch query using WHERE pk IN (...).
On 10.0.0-RC30 this does not happen — non-PK fields resolve to null.
Reproduction
type Query {
mineSynligeMiljoer: [Miljo]
@service(service: {className: "…ApplikasjonsoversiktService", method: "mineSynligeMiljoer"})
}
type Miljo implements Node @table(name: "miljo") @node(typeId: "20014", keyColumns: ["MILJOKODE"]) {
id: ID! @nodeId
kode: String @field(name: "MILJOKODE")
navn: String @field(name: "NAVN")
}
public List<MiljoRecord> mineSynligeMiljoer() {
return ctx.select(MILJO.MILJOKODE).from(MILJO)
.fetch(r -> { var rec = new MiljoRecord(); rec.setMiljokode(r.value1()); return rec; });
}
Query { mineSynligeMiljoer { kode navn } } returns
[{"kode":"demo","navn":null}, …] — navn is never fetched even though the rows
exist with non-null values (verified directly in the database). The field is
plain (no @splitQuery), non-paginated, and the return type has @table — the
documented conditions for auto-fetch.
Workaround: the service selects complete records (ctx.selectFrom(MILJO))
instead of PK-only records. Fine for small tables; defeats the documented
pattern for large ones.
Version: 10.0.0-RC30
Summary
The README ("Auto-fetching @table types from database") states that when a service
field returns a
@tabletype, Graphitron automatically fetches all requestedfields using the primary key from the service result:
On
10.0.0-RC30this does not happen — non-PK fields resolve tonull.Reproduction
Query
{ mineSynligeMiljoer { kode navn } }returns[{"kode":"demo","navn":null}, …]—navnis never fetched even though the rowsexist with non-null values (verified directly in the database). The field is
plain (no
@splitQuery), non-paginated, and the return type has@table— thedocumented conditions for auto-fetch.
Workaround: the service selects complete records (
ctx.selectFrom(MILJO))instead of PK-only records. Fine for small tables; defeats the documented
pattern for large ones.
Version:
10.0.0-RC30