[jOOQ/jOOQ#11208] ArrayStoreException when calling ResultQuery<Record[N]>.fetchArray()

This commit is contained in:
Lukas Eder 2021-01-09 12:54:06 +01:00
parent 4e460b756f
commit c7a4139bf6
2 changed files with 6 additions and 2 deletions

View File

@ -1035,6 +1035,11 @@ abstract class AbstractFetchable<R extends Record> extends AbstractQueryPart imp
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final R[] fetchArray() {
Result<R> r = fetch();
if (r.isNotEmpty())
return r.toArray((R[]) Array.newInstance(r.get(0).getClass(), r.size()));
Class<? extends R> recordType;
// TODO [#3185] Pull up getRecordType()
@ -1045,7 +1050,6 @@ abstract class AbstractFetchable<R extends Record> extends AbstractQueryPart imp
else
throw new DataAccessException("Attempt to call fetchArray() on " + getClass());
Result<R> r = fetch();
return r.toArray((R[]) Array.newInstance(recordType, r.size()));
}

View File

@ -110,7 +110,7 @@ implements
// -------------------------------------------------------------------------
// XXX: DSL API
// -------------------------------------------------------------------------
@Override
public final DropTableImpl cascade() {
this.cascade = true;