diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/FindAllYqlStatement.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/FindAllYqlStatement.java index 40abc721..de530d53 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/FindAllYqlStatement.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/FindAllYqlStatement.java @@ -11,10 +11,6 @@ public FindAllYqlStatement(@NonNull EntitySchema schema, @NonNull Schema super(schema, resultSchema); } - public FindAllYqlStatement(@NonNull EntitySchema schema, @NonNull Schema resultSchema, String tableName) { - super(schema, resultSchema, tableName); - } - @Override public String getQuery(String tablespace) { return declarations() diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/FindRangeStatement.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/FindRangeStatement.java index f05dc623..a187bad1 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/FindRangeStatement.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/FindRangeStatement.java @@ -24,11 +24,7 @@ public class FindRangeStatement, ID extends Entity private final List params; public FindRangeStatement(EntitySchema schema, Schema outSchema, Range range) { - this(schema, outSchema, range, schema.getName()); - } - - public FindRangeStatement(EntitySchema schema, Schema outSchema, Range range, String tableName) { - super(schema, outSchema, tableName); + super(schema, outSchema); this.params = Stream.of(RangeBound.values()) .flatMap(b -> toParams(b.map(range).keySet(), b)) .collect(toList()); diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/MultipleVarsYqlStatement.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/MultipleVarsYqlStatement.java index 3c8ce045..ae5cf373 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/MultipleVarsYqlStatement.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/MultipleVarsYqlStatement.java @@ -1,6 +1,5 @@ package tech.ydb.yoj.repository.ydb.statement; -import lombok.NonNull; import tech.ydb.proto.ValueProtos; import tech.ydb.yoj.databind.schema.Schema; import tech.ydb.yoj.repository.db.Entity; @@ -26,10 +25,6 @@ public MultipleVarsYqlStatement(EntitySchema schema, Schema resu super(schema, resultSchema); } - public MultipleVarsYqlStatement(EntitySchema schema, Schema resultSchema, String tableName) { - super(schema, resultSchema, tableName); - } - @Override protected String declarations() { String fieldPattern = escape("%s") + ":%s%s"; @@ -97,14 +92,6 @@ protected String toDebugParams(PARAMS params) { public abstract static class Simple> extends MultipleVarsYqlStatement { - public Simple(@NonNull Class type) { - super(EntitySchema.of(type), EntitySchema.of(type)); - } - - public Simple(@NonNull Class type, String tableName) { - super(EntitySchema.of(type), EntitySchema.of(type), tableName); - } - public Simple(EntitySchema schema) { super(schema, schema); } diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/PredicateStatement.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/PredicateStatement.java index 8f4709fb..b5573cb5 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/PredicateStatement.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/PredicateStatement.java @@ -39,17 +39,7 @@ public PredicateStatement( @NonNull PARAMS params, @NonNull Function getPredicate ) { - this(schema, outSchema, params, getPredicate, schema.getName()); - } - - public PredicateStatement( - @NonNull EntitySchema schema, - @NonNull Schema outSchema, - @NonNull PARAMS params, - @NonNull Function getPredicate, - String tableName - ) { - super(schema, outSchema, tableName); + super(schema, outSchema); this.getPredicate = getPredicate; YqlPredicate pred = getPredicate.apply(params); diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/UpdateInStatement.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/UpdateInStatement.java index 9248fa46..15a07f58 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/UpdateInStatement.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/UpdateInStatement.java @@ -37,16 +37,7 @@ public UpdateInStatement( Schema resultSchema, UpdateInStatementInput in ) { - this(schema, resultSchema, in, schema.getName()); - } - - public UpdateInStatement( - EntitySchema schema, - Schema resultSchema, - UpdateInStatementInput in, - String tableName - ) { - super(schema, resultSchema, tableName); + super(schema, resultSchema); this.keyFields = collectKeyFields(in.ids); this.values = new HashMap<>(in.values.size()); diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/YqlStatement.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/YqlStatement.java index 84063d99..361d7ed5 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/YqlStatement.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/YqlStatement.java @@ -8,9 +8,6 @@ import tech.ydb.yoj.repository.db.Entity; import tech.ydb.yoj.repository.db.EntityIdSchema; import tech.ydb.yoj.repository.db.EntitySchema; -import tech.ydb.yoj.repository.db.Range; -import tech.ydb.yoj.repository.db.Table.View; -import tech.ydb.yoj.repository.db.ViewSchema; import tech.ydb.yoj.repository.db.cache.RepositoryCache; import tech.ydb.yoj.repository.ydb.yql.YqlOrderBy; import tech.ydb.yoj.repository.ydb.yql.YqlStatementPart; @@ -53,50 +50,6 @@ public YqlStatement(@NonNull EntitySchema schema, @NonNull Schema, ID extends Entity.Id> Statement, ENTITY> findRange( - Class type, - Range range - ) { - EntitySchema schema = EntitySchema.of(type); - return new FindRangeStatement<>(schema, schema, range); - } - - public static , VIEW extends View, ID extends Entity.Id> Statement, VIEW> findRange( - Class type, - Class viewType, - Range range - ) { - return new FindRangeStatement<>(EntitySchema.of(type), ViewSchema.of(viewType), range); - } - - public static > Statement findAll( - Class type - ) { - EntitySchema schema = EntitySchema.of(type); - return findAll(schema, schema); - } - - public static , VIEW extends View> Statement findAll( - Class type, - Class viewType - ) { - return findAll(EntitySchema.of(type), ViewSchema.of(viewType)); - } - - private static , RESULT> Statement findAll( - EntitySchema schema, - Schema outSchema - ) { - return new FindAllYqlStatement<>(schema, outSchema); - } - - public static , ID extends Entity.Id> Statement, ID> findIds( - Class type, - Range range - ) { - return new FindRangeStatement<>(EntitySchema.of(type), EntityIdSchema.ofEntity(type), range); - } - @Override public void storeToCache(PARAMS params, List result, RepositoryCache cache) { if (result == null) { diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/table/YdbTable.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/table/YdbTable.java index 2ee45be2..ed8afec7 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/table/YdbTable.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/table/YdbTable.java @@ -27,7 +27,9 @@ import tech.ydb.yoj.repository.ydb.statement.CountAllStatement; import tech.ydb.yoj.repository.ydb.statement.DeleteAllStatement; import tech.ydb.yoj.repository.ydb.statement.DeleteByIdStatement; +import tech.ydb.yoj.repository.ydb.statement.FindAllYqlStatement; import tech.ydb.yoj.repository.ydb.statement.FindInStatement; +import tech.ydb.yoj.repository.ydb.statement.FindRangeStatement; import tech.ydb.yoj.repository.ydb.statement.FindStatement; import tech.ydb.yoj.repository.ydb.statement.FindYqlStatement; import tech.ydb.yoj.repository.ydb.statement.InsertYqlStatement; @@ -36,7 +38,6 @@ import tech.ydb.yoj.repository.ydb.statement.UpdateInStatement; import tech.ydb.yoj.repository.ydb.statement.UpdateModel; import tech.ydb.yoj.repository.ydb.statement.UpsertYqlStatement; -import tech.ydb.yoj.repository.ydb.statement.YqlStatement; import tech.ydb.yoj.repository.ydb.yql.YqlLimit; import tech.ydb.yoj.repository.ydb.yql.YqlListingQuery; import tech.ydb.yoj.repository.ydb.yql.YqlOrderBy; @@ -93,7 +94,8 @@ private static List toList(E first, E... rest) { @Override public List findAll() { - return postLoad(executor.execute(YqlStatement.findAll(type), null)); + var statement = new FindAllYqlStatement<>(schema, schema); + return postLoad(executor.execute(statement, null)); } /** @@ -183,7 +185,9 @@ protected List find(YqlStatementPart part, YqlStatementPart... otherPa @Override public List findAll(Class viewType) { - return executor.execute(YqlStatement.findAll(type, viewType), null); + ViewSchema viewSchema = ViewSchema.of(viewType); + var statement = new FindAllYqlStatement<>(schema, viewSchema); + return executor.execute(statement, null); } @Override @@ -248,12 +252,15 @@ public V find(Class viewType, Entity.Id id) { @Override public > List find(Range range) { - return postLoad(executor.execute(YqlStatement.findRange(type, range), range)); + var statement = new FindRangeStatement<>(schema, schema, range); + return postLoad(executor.execute(statement, range)); } @Override public > List find(Class viewType, Range range) { - return executor.execute(YqlStatement.findRange(type, viewType, range), range); + ViewSchema viewSchema = ViewSchema.of(viewType); + var statement = new FindRangeStatement<>(schema, viewSchema, range); + return executor.execute(statement, range); } @Override @@ -422,7 +429,9 @@ private > List findIds(Collection> List findIds(Range range) { - return executor.execute(YqlStatement.findIds(type, range), range); + EntityIdSchema idSchema = EntityIdSchema.ofEntity(type); + var statement = new FindRangeStatement<>(schema, idSchema, range); + return executor.execute(statement, range); } @Override