[jOOQ/jOOQ#14875] Inconsistent implementation of TableImpl::equals and

TableImpl::hashCode when comparing generated tables with plain SQL ones
This commit is contained in:
Lukas Eder 2023-05-23 11:45:59 +02:00
parent 4620f42c5d
commit bcff3882f2
2 changed files with 21 additions and 0 deletions

View File

@ -45,9 +45,11 @@ import static org.jooq.Clause.FIELD_REFERENCE;
// ...
import static org.jooq.impl.DSL.select;
import static org.jooq.impl.DefaultMetaProvider.meta;
import static org.jooq.impl.SchemaImpl.DEFAULT_SCHEMA;
import static org.jooq.impl.Tools.BooleanDataKey.DATA_OMIT_CLAUSE_EVENT_EMISSION;
import static org.jooq.impl.Tools.ExtendedDataKey.DATA_RENDER_TABLE;
import static org.jooq.impl.UpdateQueryImpl.NO_SUPPORT_UPDATE_JOIN;
import static org.jooq.tools.StringUtils.defaultIfNull;
import java.util.stream.Stream;
@ -215,6 +217,18 @@ implements
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#7172] [#10274] [#14875] Cannot use Table.getQualifiedName() based super implementation yet here
if (getTable() == null)
return getUnqualifiedName().hashCode();
else
return defaultIfNull(getTable().getSchema(), DEFAULT_SCHEMA.get()).getQualifiedName()
.append(getTable().getUnqualifiedName())
.append(getUnqualifiedName()).hashCode();
}
@Override
public boolean equals(Object that) {
if (this == that)

View File

@ -615,6 +615,13 @@ implements
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#7172] [#10274] [#14875] Cannot use getQualifiedName() based super implementation yet here
return defaultIfNull(getSchema(), DEFAULT_SCHEMA.get()).getQualifiedName().append(getUnqualifiedName()).hashCode();
}
@Override
public boolean equals(Object that) {
if (this == that)