setForeignKeyEnabledByDefault

fun setForeignKeyEnabledByDefault(enabled: Boolean)

This configuration is only useful for {@link org.babyfish.jimmer.sql.JoinColumn} of local associations (not remote associations across microservice boundaries) whose foreignKeyType is specified as AUTO.Its value indicates whether the foreign key is real, that is, whether there is a foreign key constraint in the database.

In general, you should ignore this configuration (defaults to true) or set it to true.

In some cases, you need to set it to false, such as

  • Using database/table sharding technology, such as sharding-jdbc
  • Using database that does not support foreign key, such as TiDB