Skip to content

Commit c407ff0

Browse files
committed
Polishing.
Do not expose setForeignKeyNaming methods on NamingStrategy to make less assumptions about how a naming strategy gets implemented. Provide getRequiredLeafEntity method on PersistentPropertyPathExtension to reduce null and state assertion checks. Refine getTableName/getQualifiedTableName approach to reduce API surface and avoid deprecations.
1 parent c9b941e commit c407ff0

File tree

19 files changed

+1073
-1098
lines changed

19 files changed

+1073
-1098
lines changed

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverter.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import org.apache.commons.logging.Log;
2727
import org.apache.commons.logging.LogFactory;
28+
2829
import org.springframework.context.ApplicationContext;
2930
import org.springframework.context.ApplicationContextAware;
3031
import org.springframework.core.convert.ConverterNotFoundException;
@@ -37,7 +38,6 @@
3738
import org.springframework.data.mapping.Parameter;
3839
import org.springframework.data.mapping.PersistentPropertyAccessor;
3940
import org.springframework.data.mapping.PersistentPropertyPath;
40-
import org.springframework.data.mapping.PreferredConstructor;
4141
import org.springframework.data.mapping.context.MappingContext;
4242
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
4343
import org.springframework.data.mapping.model.ParameterValueProvider;
@@ -52,7 +52,6 @@
5252
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
5353
import org.springframework.data.relational.core.sql.IdentifierProcessing;
5454
import org.springframework.data.util.TypeInformation;
55-
import org.springframework.data.util.TypeInformation;
5655
import org.springframework.lang.Nullable;
5756
import org.springframework.util.Assert;
5857

@@ -504,9 +503,7 @@ private boolean shouldCreateEmptyEmbeddedInstance(RelationalPersistentProperty p
504503

505504
private boolean hasInstanceValues(@Nullable Object idValue) {
506505

507-
RelationalPersistentEntity<?> persistentEntity = path.getLeafEntity();
508-
509-
Assert.state(persistentEntity != null, "Entity must not be null");
506+
RelationalPersistentEntity<?> persistentEntity = path.getRequiredLeafEntity();
510507

511508
for (RelationalPersistentProperty embeddedProperty : persistentEntity) {
512509

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SqlContext {
3737
SqlContext(RelationalPersistentEntity<?> entity) {
3838

3939
this.entity = entity;
40-
this.table = Table.create(entity.getFullTableName());
40+
this.table = Table.create(entity.getQualifiedTableName());
4141
}
4242

4343
Column getIdColumn() {
@@ -55,7 +55,7 @@ Table getTable() {
5555
Table getTable(PersistentPropertyPathExtension path) {
5656

5757
SqlIdentifier tableAlias = path.getTableAlias();
58-
Table table = Table.create(path.getTableName());
58+
Table table = Table.create(path.getQualifiedTableName());
5959
return tableAlias == null ? table : table.as(tableAlias);
6060
}
6161

0 commit comments

Comments
 (0)