[jOOQ/jOOQ#15876] Internal RecordDataType.getDataType() should be non-nullable for records consisting of all non-null fields
This commit is contained in:
parent
f6cff58e8b
commit
a64d56ee92
@ -73,11 +73,17 @@ final class RecordDataType<R extends Record> extends DefaultDataType<R> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RecordDataType(Row row, Class<R> recordType, String name) {
|
||||
super(null, recordType, name, name);
|
||||
super(null, recordType, name, nullability(row));
|
||||
|
||||
this.row = (AbstractRow<R>) row;
|
||||
}
|
||||
|
||||
static final Nullability nullability(Row row) {
|
||||
return Tools.anyMatch(row.fields(), f -> f.getDataType().nullable())
|
||||
? Nullability.NULL
|
||||
: Nullability.NOT_NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* [#3225] Performant constructor for creating derived types.
|
||||
*/
|
||||
|
||||
@ -59,11 +59,13 @@ import static org.jooq.impl.RecordDelegate.RecordLifecycleType.REFRESH;
|
||||
import static org.jooq.impl.RecordDelegate.RecordLifecycleType.STORE;
|
||||
import static org.jooq.impl.RecordDelegate.RecordLifecycleType.UPDATE;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.EMPTY_TABLE_FIELD;
|
||||
import static org.jooq.impl.Tools.settings;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ -133,7 +135,10 @@ public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableReco
|
||||
|
||||
@Override
|
||||
final UniqueKey<R> getPrimaryKey() {
|
||||
return getTable().getPrimaryKey();
|
||||
if (getTable() instanceof AbstractTable<R> t)
|
||||
return t.getPrimaryKeyWithEmbeddables();
|
||||
else
|
||||
return getTable().getPrimaryKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user