Revised default behaviour for back reference naming.
The new default is to take `@Table` annotations into account.
The behaviour can be configured by setting the `foreignKeyNaming` property on the `RelationalMappingContext`.
Closes#1162
See #1147
Original pull request: #1324.
@ -67,7 +67,7 @@ public class PartTreeJdbcQueryUnitTests {
@@ -67,7 +67,7 @@ public class PartTreeJdbcQueryUnitTests {
privatestaticfinalStringTABLE="\"users\"";
privatestaticfinalStringALL_FIELDS="\"users\".\"ID\" AS \"ID\", \"users\".\"AGE\" AS \"AGE\", \"users\".\"ACTIVE\" AS \"ACTIVE\", \"users\".\"LAST_NAME\" AS \"LAST_NAME\", \"users\".\"FIRST_NAME\" AS \"FIRST_NAME\", \"users\".\"DATE_OF_BIRTH\" AS \"DATE_OF_BIRTH\", \"users\".\"HOBBY_REFERENCE\" AS \"HOBBY_REFERENCE\", \"hated\".\"NAME\" AS \"HATED_NAME\", \"users\".\"USER_CITY\" AS \"USER_CITY\", \"users\".\"USER_STREET\" AS \"USER_STREET\"";
privatestaticfinalStringJOIN_CLAUSE="FROM \"users\" LEFT OUTER JOIN \"HOBBY\" \"hated\" ON \"hated\".\"USER\" = \"users\".\"ID\"";
privatestaticfinalStringJOIN_CLAUSE="FROM \"users\" LEFT OUTER JOIN \"HOBBY\" \"hated\" ON \"hated\".\"USERS\" = \"users\".\"ID\"";
@ -32,7 +32,7 @@ public class DefaultNamingStrategy implements NamingStrategy {
@@ -32,7 +32,7 @@ public class DefaultNamingStrategy implements NamingStrategy {
@ -249,10 +249,10 @@ Also, the type of that aggregate is encoded in a type parameter.
@@ -249,10 +249,10 @@ Also, the type of that aggregate is encoded in a type parameter.
==== Back References
All references in an aggregate result in a foreign key relationship in the opposite direction in the database.
By default, the name of the foreign key column is the table name of the referencing entity, ignoring any table annotations.
By default, the name of the foreign key column is the table name of the referencing entity.
Alternatively you may choose to have them named by the actual table name of the referencing entity.
You activate this behaviour by calling `setForeignKeyNaming(ForeignKeyNaming.APPLY_RENAMING)` on the `RelationalMappingContext`.
Alternatively you may choose to have them named by the entity name of the referencing entity ignoreing `@Table` annotations.
You activate this behaviour by calling `setForeignKeyNaming(ForeignKeyNaming.IGNORE_RENAMING)` on the `RelationalMappingContext`.
For `List` and `Map` references an additional column is required for holding the list index or map key. It is based on the foreign key column with an additional `_KEY` suffix.