diff --git a/project/build.gradle.kts b/project/build.gradle.kts index 40dfd3fb40..b7027fee18 100644 --- a/project/build.gradle.kts +++ b/project/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "org.babyfish.jimmer" - version = "0.8.113" + version = "0.8.114" } diff --git a/project/jimmer-apt/build.gradle.kts b/project/jimmer-apt/build.gradle.kts index 2bfd5da54a..e789b366e7 100644 --- a/project/jimmer-apt/build.gradle.kts +++ b/project/jimmer-apt/build.gradle.kts @@ -16,6 +16,7 @@ repositories { dependencies { implementation("javax.validation:validation-api:2.0.1.Final") + implementation("jakarta.validation:jakarta.validation-api:2.0.2") implementation("org.springframework:spring-core:5.3.20") implementation("com.intellij:annotations:12.0") implementation("com.squareup:javapoet:1.13.0") diff --git a/project/jimmer-core-kotlin/build.gradle.kts b/project/jimmer-core-kotlin/build.gradle.kts index 84d3c44284..cd69dfd59b 100644 --- a/project/jimmer-core-kotlin/build.gradle.kts +++ b/project/jimmer-core-kotlin/build.gradle.kts @@ -15,6 +15,7 @@ dependencies { testAnnotationProcessor(project(":jimmer-apt")) testImplementation(kotlin("test")) + testImplementation("javax.validation:validation-api:2.0.1.Final") testImplementation("org.mapstruct:mapstruct:1.5.3.Final") diff --git a/project/jimmer-core/build.gradle.kts b/project/jimmer-core/build.gradle.kts index 8c066c0d3b..d0857c23af 100644 --- a/project/jimmer-core/build.gradle.kts +++ b/project/jimmer-core/build.gradle.kts @@ -16,7 +16,7 @@ repositories { dependencies { - api("javax.validation:validation-api:2.0.1.Final") + implementation("javax.validation:validation-api:2.0.1.Final") api("com.fasterxml.jackson.core:jackson-databind:2.15.2") api("org.jetbrains.kotlin:kotlin-reflect:1.7.10") implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2") @@ -24,6 +24,7 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib:1.7.10") compileOnly("org.mapstruct:mapstruct:1.5.3.Final") + testImplementation("javax.validation:validation-api:2.0.1.Final") testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") testImplementation("org.mapstruct:mapstruct:1.5.3.Final") testImplementation("org.projectlombok:lombok:1.18.30") diff --git a/project/jimmer-core/src/main/java/org/babyfish/jimmer/JimmerVersion.java b/project/jimmer-core/src/main/java/org/babyfish/jimmer/JimmerVersion.java index 30c2c38579..d434b9118c 100644 --- a/project/jimmer-core/src/main/java/org/babyfish/jimmer/JimmerVersion.java +++ b/project/jimmer-core/src/main/java/org/babyfish/jimmer/JimmerVersion.java @@ -5,7 +5,7 @@ public class JimmerVersion { public static final JimmerVersion CURRENT = - new JimmerVersion(0, 8, 113); + new JimmerVersion(0, 8, 114); private final int major; diff --git a/project/jimmer-core/src/main/java/org/babyfish/jimmer/meta/impl/PropDescriptor.java b/project/jimmer-core/src/main/java/org/babyfish/jimmer/meta/impl/PropDescriptor.java index b986ef0fe9..610a511b4f 100644 --- a/project/jimmer-core/src/main/java/org/babyfish/jimmer/meta/impl/PropDescriptor.java +++ b/project/jimmer-core/src/main/java/org/babyfish/jimmer/meta/impl/PropDescriptor.java @@ -593,6 +593,7 @@ private void conflict(Class annotationType1, Class annotationType2) { for (Class annotationType : sqlTypes) { annotationMap.put(annotationType.getName(), annotationType); } + annotationMap.put(javax.validation.constraints.Null.class.getName(), javax.validation.constraints.Null.class); annotationMap.put(org.jetbrains.annotations.Nullable.class.getName(), org.jetbrains.annotations.Nullable.class); annotationMap.put(javax.validation.constraints.NotNull.class.getName(), javax.validation.constraints.NotNull.class); diff --git a/project/jimmer-ksp/build.gradle.kts b/project/jimmer-ksp/build.gradle.kts index 4aa979b592..f461e6adf5 100644 --- a/project/jimmer-ksp/build.gradle.kts +++ b/project/jimmer-ksp/build.gradle.kts @@ -17,6 +17,9 @@ dependencies { implementation("com.squareup:kotlinpoet:1.12.0") implementation("com.squareup:kotlinpoet-ksp:1.12.0") + implementation("javax.validation:validation-api:2.0.1.Final") + implementation("jakarta.validation:jakarta.validation-api:2.0.2") + dokkaHtmlPlugin("org.jetbrains.dokka:dokka-base:1.6.0") } diff --git a/project/jimmer-spring-boot-starter/src/main/java/org/babyfish/jimmer/spring/JSpringSqlClient.java b/project/jimmer-spring-boot-starter/src/main/java/org/babyfish/jimmer/spring/JSpringSqlClient.java index 0d90ddcf4d..2262bb1686 100644 --- a/project/jimmer-spring-boot-starter/src/main/java/org/babyfish/jimmer/spring/JSpringSqlClient.java +++ b/project/jimmer-spring-boot-starter/src/main/java/org/babyfish/jimmer/spring/JSpringSqlClient.java @@ -131,8 +131,8 @@ protected JSqlClient.Builder createBuilder() { builder.setDefaultBatchSize(properties.getDefaultBatchSize()); builder.setDefaultListBatchSize(properties.getDefaultListBatchSize()); builder.setOffsetOptimizingThreshold(properties.getOffsetOptimizingThreshold()); + builder.setDefaultLockMode(properties.getDefaultLockMode()); builder.setForeignKeyEnabledByDefault(properties.isForeignKeyEnabledByDefault()); - builder.setSaveCommandPessimisticLock(properties.isSaveCommandPessimisticLock()); builder.setExecutorContextPrefixes(properties.getExecutorContextPrefixes()); if (properties.isShowSql()) { builder.setExecutor(Executor.log(executor)); diff --git a/project/jimmer-spring-boot-starter/src/main/java/org/babyfish/jimmer/spring/cfg/JimmerProperties.java b/project/jimmer-spring-boot-starter/src/main/java/org/babyfish/jimmer/spring/cfg/JimmerProperties.java index d19c943952..bf1447f82b 100644 --- a/project/jimmer-spring-boot-starter/src/main/java/org/babyfish/jimmer/spring/cfg/JimmerProperties.java +++ b/project/jimmer-spring-boot-starter/src/main/java/org/babyfish/jimmer/spring/cfg/JimmerProperties.java @@ -4,6 +4,7 @@ import org.babyfish.jimmer.client.generator.ts.NullRenderMode; import org.babyfish.jimmer.sql.EnumType; import org.babyfish.jimmer.sql.JSqlClient; +import org.babyfish.jimmer.sql.ast.mutation.LockMode; import org.babyfish.jimmer.sql.dialect.DefaultDialect; import org.babyfish.jimmer.sql.dialect.Dialect; import org.babyfish.jimmer.sql.event.TriggerType; @@ -55,9 +56,9 @@ public class JimmerProperties { private final int offsetOptimizingThreshold; - private final boolean isForeignKeyEnabledByDefault; + private final LockMode defaultLockMode; - private final boolean saveCommandPessimisticLock; + private final boolean isForeignKeyEnabledByDefault; private final Collection executorContextPrefixes; @@ -86,8 +87,8 @@ public JimmerProperties( @Nullable Integer defaultBatchSize, @Nullable Integer defaultListBatchSize, @Nullable Integer offsetOptimizingThreshold, + @Nullable LockMode defaultLockMode, @Nullable Boolean isForeignKeyEnabledByDefault, // Default value is true, so use `Boolean` - boolean saveCommandPessimisticLock, @Nullable Collection executorContextPrefixes, @Nullable String microServiceName, @Nullable ErrorTranslator errorTranslator, @@ -202,7 +203,7 @@ public JimmerProperties( isForeignKeyEnabledByDefault != null ? isForeignKeyEnabledByDefault : true; - this.saveCommandPessimisticLock = saveCommandPessimisticLock; + this.defaultLockMode = defaultLockMode != null ? defaultLockMode : LockMode.OPTIMISTIC; this.executorContextPrefixes = executorContextPrefixes; this.microServiceName = microServiceName != null ? @@ -301,6 +302,10 @@ public int getOffsetOptimizingThreshold() { return offsetOptimizingThreshold; } + public LockMode getDefaultLockMode() { + return defaultLockMode; + } + /** * This configuration is only useful for {@link org.babyfish.jimmer.sql.JoinColumn} * of local associations (not remote associations across microservice boundaries) @@ -319,10 +324,6 @@ public boolean isForeignKeyEnabledByDefault() { return isForeignKeyEnabledByDefault; } - public boolean isSaveCommandPessimisticLock() { - return saveCommandPessimisticLock; - } - /** * If this option is configured, when jimmer calls back * `org.babyfish.jimmer.sql.runtime.Executor.execute` before executing SQL, diff --git a/project/jimmer-sql-kotlin/build.gradle.kts b/project/jimmer-sql-kotlin/build.gradle.kts index df78191727..c7b4beb0ef 100644 --- a/project/jimmer-sql-kotlin/build.gradle.kts +++ b/project/jimmer-sql-kotlin/build.gradle.kts @@ -20,6 +20,7 @@ dependencies { testAnnotationProcessor(project(":jimmer-ksp")) testImplementation("com.h2database:h2:2.1.212") + testImplementation("javax.validation:validation-api:2.0.1.Final") dokkaHtmlPlugin("org.jetbrains.dokka:dokka-base:1.6.0") testImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2") testImplementation("org.postgresql:postgresql:42.3.6") diff --git a/project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/cfg/KSqlClientDsl.kt b/project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/cfg/KSqlClientDsl.kt index 91ca0d525b..407632a574 100644 --- a/project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/cfg/KSqlClientDsl.kt +++ b/project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/cfg/KSqlClientDsl.kt @@ -214,10 +214,6 @@ class KSqlClientDsl constructor( javaBuilder.setIdOnlyTargetCheckingLevel(checkingLevel) } - fun setSaveCommandPessimisticLock(lock: Boolean = true) { - javaBuilder.setSaveCommandPessimisticLock(lock) - } - fun addDraftInterceptor(interceptor: DraftInterceptor<*, *>) { javaBuilder.addDraftInterceptor(interceptor) } diff --git a/project/jimmer-sql/build.gradle.kts b/project/jimmer-sql/build.gradle.kts index d001e03ab5..3cdee7d523 100644 --- a/project/jimmer-sql/build.gradle.kts +++ b/project/jimmer-sql/build.gradle.kts @@ -27,7 +27,10 @@ dependencies { implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2") compileOnly("org.postgresql:postgresql:42.3.6") compileOnly("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2") - antlr("org.antlr:antlr4:4.13.0") + + antlr("org.antlr:antlr4:4.13.0") { + exclude("com.ibm.icu", "icu4j") + } testAnnotationProcessor(project(":jimmer-apt")) @@ -44,6 +47,7 @@ dependencies { testImplementation("mysql:mysql-connector-java:8.0.29") testImplementation("org.postgresql:postgresql:42.3.6") testImplementation("org.apache.kafka:connect-api:0.10.0.0") + testImplementation("javax.validation:validation-api:2.0.1.Final") // testImplementation(files("/Users/chentao/Downloads/ojdbc8-21.9.0.0.jar")) } diff --git a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/JSqlClient.java b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/JSqlClient.java index ace9533b3b..3715aa5f47 100644 --- a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/JSqlClient.java +++ b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/JSqlClient.java @@ -364,6 +364,10 @@ interface Builder { @OldChain Builder setOffsetOptimizingThreshold(int threshold); + /** + * Set deault lock mode of save command + * @param lockMode + */ @OldChain Builder setDefaultLockMode(LockMode lockMode); @@ -414,12 +418,6 @@ interface Builder { @OldChain Builder setIdOnlyTargetCheckingLevel(IdOnlyTargetCheckingLevel checkingLevel); - @OldChain - Builder setSaveCommandPessimisticLock(); - - @OldChain - Builder setSaveCommandPessimisticLock(boolean lock); - @OldChain Builder addDraftInterceptor(DraftInterceptor interceptor); diff --git a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/JSqlClientImpl.java b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/JSqlClientImpl.java index cf6f6e574d..05ceeacf67 100644 --- a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/JSqlClientImpl.java +++ b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/JSqlClientImpl.java @@ -105,8 +105,6 @@ class JSqlClientImpl implements JSqlClientImplementor { private final IdOnlyTargetCheckingLevel idOnlyTargetCheckingLevel; - private final boolean saveCommandPessimisticLock; - private final DraftInterceptorManager draftInterceptorManager; private final String microServiceName; @@ -117,8 +115,6 @@ class JSqlClientImpl implements JSqlClientImplementor { private final ReaderManager readerManager = new ReaderManager(this); - private final ReadWriteLock initializationLock = new ReentrantReadWriteLock(); - private SqlClientInitializer sqlClientInitializer; private JSqlClientImpl( @@ -147,7 +143,6 @@ private JSqlClientImpl( TransientResolverManager transientResolverManager, boolean defaultDissociationActionCheckable, IdOnlyTargetCheckingLevel idOnlyTargetCheckingLevel, - boolean saveCommandPessimisticLock, DraftInterceptorManager draftInterceptorManager, String microServiceName, MicroServiceExchange microServiceExchange, @@ -196,7 +191,6 @@ private JSqlClientImpl( this.transientResolverManager = transientResolverManager; this.defaultDissociationActionCheckable = defaultDissociationActionCheckable; this.idOnlyTargetCheckingLevel = idOnlyTargetCheckingLevel; - this.saveCommandPessimisticLock = saveCommandPessimisticLock; this.draftInterceptorManager = draftInterceptorManager; this.microServiceName = microServiceName; this.microServiceExchange = microServiceExchange; @@ -481,7 +475,6 @@ public JSqlClientImplementor caches(Consumer block) { transientResolverManager, defaultDissociationActionCheckable, idOnlyTargetCheckingLevel, - saveCommandPessimisticLock, draftInterceptorManager, microServiceName, microServiceExchange, @@ -525,7 +518,6 @@ public JSqlClientImplementor filters(Consumer block) { transientResolverManager, defaultDissociationActionCheckable, idOnlyTargetCheckingLevel, - saveCommandPessimisticLock, draftInterceptorManager, microServiceName, microServiceExchange, @@ -564,7 +556,6 @@ public JSqlClientImplementor disableSlaveConnectionManager() { transientResolverManager, defaultDissociationActionCheckable, idOnlyTargetCheckingLevel, - saveCommandPessimisticLock, draftInterceptorManager, microServiceName, microServiceExchange, @@ -606,7 +597,6 @@ public JSqlClientImplementor executor(Executor executor) { transientResolverManager, defaultDissociationActionCheckable, idOnlyTargetCheckingLevel, - saveCommandPessimisticLock, draftInterceptorManager, microServiceName, microServiceExchange, @@ -1171,17 +1161,6 @@ public Builder setIdOnlyTargetCheckingLevel(IdOnlyTargetCheckingLevel checkingLe return this; } - @Override - public Builder setSaveCommandPessimisticLock() { - return setSaveCommandPessimisticLock(true); - } - - @Override - public Builder setSaveCommandPessimisticLock(boolean lock) { - saveCommandPessimisticLock = lock; - return this; - } - @Override public Builder addDraftInterceptor(DraftInterceptor interceptor) { return addDraftInterceptors(Collections.singletonList(interceptor)); @@ -1442,7 +1421,6 @@ public JSqlClient build() { transientResolverManager, defaultDissociationActionCheckable, idOnlyTargetCheckingLevel, - saveCommandPessimisticLock, new DraftInterceptorManager(interceptors), microServiceName, microServiceExchange, diff --git a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/ast/impl/table/FetcherSelectionImpl.java b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/ast/impl/table/FetcherSelectionImpl.java index 6247b3ea5f..bb403c1d1e 100644 --- a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/ast/impl/table/FetcherSelectionImpl.java +++ b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/ast/impl/table/FetcherSelectionImpl.java @@ -109,7 +109,8 @@ private void renderEmbedded( } } else { for (Field field : childFetcher.getFieldMap().values()) { - if (field.getProp().isFormula()) { + ImmutableProp prop = field.getProp(); + if (prop.isFormula() && prop.getSqlTemplate() == null) { continue; } String propName = field.getProp().getName(); diff --git a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/ast/query/TypedRootQuery.java b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/ast/query/TypedRootQuery.java index 09821d4d2e..b64029bb3a 100644 --- a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/ast/query/TypedRootQuery.java +++ b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/ast/query/TypedRootQuery.java @@ -2,9 +2,9 @@ import org.babyfish.jimmer.sql.ast.Executable; import org.babyfish.jimmer.sql.runtime.ExecutionException; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.validation.constraints.NotNull; import java.sql.Connection; import java.util.List; import java.util.Optional; diff --git a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/DissociationInfo.java b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/DissociationInfo.java index b1803476b4..8040ea3936 100644 --- a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/DissociationInfo.java +++ b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/DissociationInfo.java @@ -3,14 +3,11 @@ import org.babyfish.jimmer.meta.ImmutableProp; import org.babyfish.jimmer.meta.TargetLevel; import org.babyfish.jimmer.sql.DissociateAction; -import org.babyfish.jimmer.sql.ManyToOne; -import org.babyfish.jimmer.sql.OneToOne; import org.babyfish.jimmer.sql.meta.MetadataStrategy; import org.babyfish.jimmer.sql.meta.MiddleTable; import org.babyfish.jimmer.sql.meta.Storage; +import org.jetbrains.annotations.NotNull; -import javax.validation.constraints.NotNull; -import java.lang.annotation.Annotation; import java.util.List; import java.util.Objects; diff --git a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/DynamicEmbeddedReader.java b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/DynamicEmbeddedReader.java index b192428b73..c6be415f34 100644 --- a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/DynamicEmbeddedReader.java +++ b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/DynamicEmbeddedReader.java @@ -7,6 +7,7 @@ import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.List; class DynamicEmbeddedReader implements Reader { @@ -26,20 +27,24 @@ class DynamicEmbeddedReader implements Reader { @Override public Object read(ResultSet rs, Context ctx) throws SQLException { DraftSpi spi = (DraftSpi) type.getDraftFactory().apply(ctx.draftContext(), null); + boolean returnNull = false; try { int size = readers.size(); for (int i = 0; i < size; i++) { Object value = readers.get(i).read(rs, ctx); - ImmutableProp prop = props.get(i); - if (value == null && !prop.isNullable()) { - return null; + if (!returnNull) { + ImmutableProp prop = props.get(i); + if (value == null && !prop.isNullable()) { + returnNull = true; + } else { + spi.__set(prop.getId(), value); + } } - spi.__set(prop.getId(), value); } } catch (Throwable ex) { throw DraftConsumerUncheckedException.rethrow(ex); } - return ctx.resolve(spi); + return returnNull ? null : ctx.resolve(spi); } @Override diff --git a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/ReaderManager.java b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/ReaderManager.java index 6362a2472b..ed750eb713 100644 --- a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/ReaderManager.java +++ b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/ReaderManager.java @@ -693,6 +693,7 @@ private static class FixedEmbeddedReader implements Reader { if (childProp.isEmbedded(EmbeddedLevel.SCALAR)) { map.put(childProp, new FixedEmbeddedReader(childProp.getTargetType(), readerManager)); } else if (!childProp.isFormula()) { + assert childProp.getSqlTemplate() == null; // SQL formula is not supported by embeddable map.put(childProp, readerManager.scalarReader(childProp)); } } @@ -703,20 +704,24 @@ private static class FixedEmbeddedReader implements Reader { @Override public Object read(ResultSet rs, Context ctx) throws SQLException { DraftSpi spi = (DraftSpi) targetType.getDraftFactory().apply(ctx.draftContext(), null); + boolean returnNull = false; try { int size = readers.length; for (int i = 0; i < size; i++) { ImmutableProp prop = props[i]; Object value = readers[i].read(rs, ctx); - if (value != null || prop.isNullable()) { - spi.__set(prop.getId(), value); + if (!returnNull) { + if (value == null && !prop.isNullable()) { + returnNull = true; + } else { + spi.__set(prop.getId(), value); + } } } } catch (Throwable ex) { return DraftConsumerUncheckedException.rethrow(ex); } - Object embedded = ctx.resolve(spi); - return EmbeddableObjects.isCompleted(embedded) ? embedded : null; + return returnNull ? null : ctx.resolve(spi); } } diff --git a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/Readers.java b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/Readers.java index 30945f52d4..3e48115c8a 100644 --- a/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/Readers.java +++ b/project/jimmer-sql/src/main/java/org/babyfish/jimmer/sql/runtime/Readers.java @@ -150,6 +150,7 @@ public static Reader createDynamicEmbeddableReader(JSqlClientImplementor sqlC if (prop.isEmbedded(EmbeddedLevel.SCALAR)) { reader = createDynamicEmbeddableReader(sqlClient, prop.getTargetType(), null); } else if (!prop.isFormula()) { + assert prop.getSqlTemplate() == null; // SQL formula is not supported by embeddable reader = sqlClient.getReader(prop); } else { reader = null; @@ -166,6 +167,7 @@ public static Reader createDynamicEmbeddableReader(JSqlClientImplementor sqlC if (prop.isEmbedded(EmbeddedLevel.SCALAR)) { reader = createDynamicEmbeddableReader(sqlClient, prop.getTargetType(), field.getChildFetcher()); } else if (!prop.isFormula()) { + assert prop.getSqlTemplate() == null; // SQL formula is not supported by embeddable reader = sqlClient.getReader(prop); } else { reader = null;