[jOOQ/jOOQ#13639] Fix a few regressions

The new inverse foreign key code generation regressed on
[jOOQ/jOOQ#9758] and [jOOQ/jOOQ#11032]
This commit is contained in:
Lukas Eder 2023-05-01 16:09:33 +02:00
parent 72d7c3c8e8
commit ffb9414667
2 changed files with 8 additions and 1 deletions

View File

@ -221,6 +221,9 @@ public class DefaultGeneratorStrategy extends AbstractGeneratorStrategy {
else if (definition instanceof ForeignKeyDefinition && asList(POSTGRES, SQLITE, YUGABYTEDB).contains(definition.getDatabase().getDialect().family()))
return ((ForeignKeyDefinition) definition).getTable().getOutputName().toUpperCase(targetLocale) + "__" + definition.getOutputName().toUpperCase(targetLocale);
else if (definition instanceof InverseForeignKeyDefinition && asList(POSTGRES, SQLITE, YUGABYTEDB).contains(definition.getDatabase().getDialect().family()))
return ((InverseForeignKeyDefinition) definition).getReferencingTable().getOutputName().toUpperCase(targetLocale) + "__" + definition.getOutputName().toUpperCase(targetLocale);
// [#10481] Embeddables have a defining name (class name) and a referencing name (identifier name, member name).
else if (definition instanceof EmbeddableDefinition)
return ((EmbeddableDefinition) definition).getReferencingOutputName().toUpperCase(targetLocale);

View File

@ -64,6 +64,8 @@ import org.jooq.meta.ColumnDefinition;
import org.jooq.meta.Definition;
import org.jooq.meta.EnumDefinition;
import org.jooq.meta.ForeignKeyDefinition;
import org.jooq.meta.InverseForeignKeyDefinition;
import org.jooq.meta.ManyToManyKeyDefinition;
import org.jooq.meta.ParameterDefinition;
import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
@ -214,7 +216,9 @@ class GeneratorStrategyWrapper extends AbstractDelegatingGeneratorStrategy {
}
// [#11032] Foreign keys produce implicit join methods that can collide with TableImpl methods
else if (definition instanceof ForeignKeyDefinition) {
else if (definition instanceof ForeignKeyDefinition
|| definition instanceof InverseForeignKeyDefinition
|| definition instanceof ManyToManyKeyDefinition) {
reserved = reservedColumns(TableImpl.class, 0);
}