當我當前使用Jooq進行查詢時,我明確將每個記錄對象轉換爲預期的記錄類型。從jooq到特定記錄的映射提取/結果
Result<Record> result = sql.select().from(Tables.COUNTRY).fetch();
for (Record r : result) {
CountryRecord countryRecord = (CountryRecord) r;
//Extract data from countryRecord
countryRecord.getId();
}
是它與Jooq,可能對結果投直入所需的記錄型?
如(不編譯):
Result<CountryRecord> countryRecords = (Result<CountryRecord>) sql.select().from(Tables.COUNTRY).fetch();
for (CountryRecord cr : countryRecords) {
cr.getNamet();
//etc...
}
謝謝,按預期工作。 – aksamit