Class YdbTable<T extends tech.ydb.yoj.repository.db.Entity<T>>

java.lang.Object
tech.ydb.yoj.repository.ydb.table.YdbTable<T>
All Implemented Interfaces:
tech.ydb.yoj.repository.db.Table<T>

public class YdbTable<T extends tech.ydb.yoj.repository.db.Entity<T>> extends Object implements tech.ydb.yoj.repository.db.Table<T>
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static interface 
     

    Nested classes/interfaces inherited from interface tech.ydb.yoj.repository.db.Table

    tech.ydb.yoj.repository.db.Table.RecordViewId<E extends tech.ydb.yoj.repository.db.Entity<E>>, tech.ydb.yoj.repository.db.Table.View, tech.ydb.yoj.repository.db.Table.ViewId<E extends tech.ydb.yoj.repository.db.Entity<E>>
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
     
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends tech.ydb.yoj.repository.db.Entity<T>>
    List<YqlStatementPart<? extends YqlStatementPart<?>>>
    buildStatementParts(String indexName, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit, Long offset)
     
    static <T extends tech.ydb.yoj.repository.db.Entity<T>>
    List<YqlStatementPart<? extends YqlStatementPart<?>>>
    buildStatementParts(tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit, Long offset)
     
    void
    bulkUpsert(List<T> input, tech.ydb.yoj.repository.db.bulk.BulkParams params)
     
    long
    count(String indexName, tech.ydb.yoj.databind.expression.FilterExpression<T> filter)
     
    long
    count(YqlStatementPart<?>... parts)
     
    long
     
    void
    delete(tech.ydb.yoj.repository.db.Entity.Id<T> id)
     
    void
     
    <V extends tech.ydb.yoj.repository.db.Table.View, K>
    List<V>
    find(Class<V> viewType, String indexName, Set<K> keys, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit)
     
    <V extends tech.ydb.yoj.repository.db.Table.View>
    List<V>
    find(Class<V> viewType, String indexName, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit, Long offset, boolean distinct)
     
    <V extends tech.ydb.yoj.repository.db.Table.View>
    List<V>
    find(Class<V> viewType, Collection<? extends YqlStatementPart<?>> parts, boolean distinct)
     
    <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<V>
    find(Class<V> viewType, Set<ID> ids)
     
    <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<V>
    find(Class<V> viewType, Set<ID> ids, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit)
     
    <V extends tech.ydb.yoj.repository.db.Table.View>
    V
    find(Class<V> viewType, tech.ydb.yoj.repository.db.Entity.Id<T> id)
     
    <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<V>
    find(Class<V> viewType, tech.ydb.yoj.repository.db.Range<ID> range)
     
    <V extends tech.ydb.yoj.repository.db.Table.View>
    List<V>
    find(Class<V> viewType, YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
     
    <K> List<T>
    find(String indexName, Set<K> keys, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit)
     
    find(String indexName, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit, Long offset)
     
    find(Collection<? extends YqlStatementPart<?>> parts)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<T>
    find(Set<ID> ids, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit)
     
    find(tech.ydb.yoj.repository.db.Entity.Id<T> id)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<T>
    find(tech.ydb.yoj.repository.db.Range<ID> range)
     
    final List<T>
    find(YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
     
     
    <V extends tech.ydb.yoj.repository.db.Table.View>
    List<V>
    findAll(Class<V> viewType)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<ID>
    findIds(String indexName, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit, Long offset)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<ID>
    findIds(Set<ID> partialIds)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<ID>
    findIds(tech.ydb.yoj.repository.db.Range<ID> range)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<ID>
    findIds(YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    List<T>
    findUncached(Set<ID> ids, tech.ydb.yoj.databind.expression.FilterExpression<T> filter, tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, Integer limit)
     
    tech.ydb.yoj.repository.db.cache.FirstLevelCache
     
    insert(T t)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    void
    migrate(ID id)
    Migrates the specified entity and its projections, if any.
     
    <V extends tech.ydb.yoj.repository.db.Table.ViewId<T>, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    Stream<V>
    readTable(Class<V> viewClass, tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    Stream<T>
    readTable(tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    Stream<ID>
    readTableIds(tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
     
    save(T t)
     
    streamAll(int batchSize)
    Provides stream for all entities in a collection.
    <V extends tech.ydb.yoj.repository.db.Table.ViewId<T>>
    Stream<V>
    streamAll(Class<V> viewType, int batchSize)
    view support for streamAll(int)
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    Stream<ID>
    streamAllIds(int batchSize)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    Stream<T>
    streamPartial(ID partial, int batchSize)
    Provides stream for entities in a collection filtered by partial PK.
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>, V extends tech.ydb.yoj.repository.db.Table.ViewId<T>>
    Stream<V>
    streamPartial(Class<V> viewType, ID partial, int batchSize)
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    Stream<ID>
    streamPartialIds(ID partial, int batchSize)
     
    void
    update(tech.ydb.yoj.repository.db.Entity.Id<T> id, tech.ydb.yoj.repository.db.statement.Changeset changeset)
     
    <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>>
    void
    updateIn(Collection<ID> ids, tech.ydb.yoj.repository.db.statement.Changeset changeset)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface tech.ydb.yoj.repository.db.Table

    count, delete, delete, deleteAll, deleteAll, deleteIfExists, find, find, find, findOrDefault, generateAndSaveNew, getType, insert, insertAll, list, list, modifyIfPresent, postLoad, query, readTable, readTableIds, saveNewOrThrow, saveOrUpdate, toQueryBuilder, updateExistingOrThrow
  • Constructor Details

  • Method Details

    • findAll

      public List<T> findAll()
      Specified by:
      findAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • streamAll

      public Stream<T> streamAll(int batchSize)
      Provides stream for all entities in a collection. Makes mutliple queries if necessary, each selecting at most batchSize. batchSize should be small enough to ensure that batch does not exceed 40Mib
      Specified by:
      streamAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
      Parameters:
      batchSize - number of entities to fetch in query to db. Max 5000.
      Returns:
      stream of all entities in a collection
    • streamAll

      public <V extends tech.ydb.yoj.repository.db.Table.ViewId<T>> Stream<V> streamAll(Class<V> viewType, int batchSize)
      view support for streamAll(int)
      Specified by:
      streamAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • streamPartial

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<T> streamPartial(ID partial, int batchSize)
      Provides stream for entities in a collection filtered by partial PK. Makes mutliple queries if necessary, each selecting at most batchSize. batchSize should be small enough to ensure that batch does not exceed 40Mib
      Specified by:
      streamPartial in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
      Parameters:
      partial - partial PK
      batchSize - number of entities to fetch in query to db. Max 5000.
      Returns:
      stream of selected entities in a collection
    • streamPartial

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>, V extends tech.ydb.yoj.repository.db.Table.ViewId<T>> Stream<V> streamPartial(Class<V> viewType, ID partial, int batchSize)
      Specified by:
      streamPartial in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • streamAllIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<ID> streamAllIds(int batchSize)
      Specified by:
      streamAllIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • streamPartialIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<ID> streamPartialIds(ID partial, int batchSize)
      Specified by:
      streamPartialIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • findAll

      public <V extends tech.ydb.yoj.repository.db.Table.View> List<V> findAll(Class<V> viewType)
      Specified by:
      findAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • deleteAll

      public void deleteAll()
      Specified by:
      deleteAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • bulkUpsert

      public void bulkUpsert(List<T> input, tech.ydb.yoj.repository.db.bulk.BulkParams params)
      Specified by:
      bulkUpsert in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • readTable

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<T> readTable(tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
      Specified by:
      readTable in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • readTableIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<ID> readTableIds(tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
      Specified by:
      readTableIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • readTable

      public <V extends tech.ydb.yoj.repository.db.Table.ViewId<T>, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<V> readTable(Class<V> viewClass, tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
      Specified by:
      readTable in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public T find(tech.ydb.yoj.repository.db.Entity.Id<T> id)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View> V find(Class<V> viewType, tech.ydb.yoj.repository.db.Entity.Id<T> id)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<T> find(tech.ydb.yoj.repository.db.Range<ID> range)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<V> find(Class<V> viewType, tech.ydb.yoj.repository.db.Range<ID> range)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<V> find(Class<V> viewType, Set<ID> ids)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public final List<T> find(YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
    • find

      public List<T> find(Collection<? extends YqlStatementPart<?>> parts)
    • countAll

      public long countAll()
      Specified by:
      countAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • count

      public long count(String indexName, tech.ydb.yoj.databind.expression.FilterExpression<T> filter)
      Specified by:
      count in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public List<T> find(@Nullable String indexName, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • findIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<ID> findIds(@Nullable String indexName, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset)
      Specified by:
      findIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View> List<V> find(Class<V> viewType, @Nullable String indexName, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset, boolean distinct)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<T> find(Set<ID> ids, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • findUncached

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<T> findUncached(Set<ID> ids, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      findUncached in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<V> find(Class<V> viewType, Set<ID> ids, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <K> List<T> find(String indexName, Set<K> keys, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View, K> List<V> find(Class<V> viewType, String indexName, Set<K> keys, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • buildStatementParts

      public static <T extends tech.ydb.yoj.repository.db.Entity<T>> List<YqlStatementPart<? extends YqlStatementPart<?>>> buildStatementParts(@Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset)
    • buildStatementParts

      public static <T extends tech.ydb.yoj.repository.db.Entity<T>> List<YqlStatementPart<? extends YqlStatementPart<?>>> buildStatementParts(@Nullable String indexName, @Nullable tech.ydb.yoj.databind.expression.FilterExpression<T> filter, @Nullable tech.ydb.yoj.databind.expression.OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset)
    • count

      public long count(YqlStatementPart<?>... parts)
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View> List<V> find(Class<V> viewType, YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View> List<V> find(Class<V> viewType, Collection<? extends YqlStatementPart<?>> parts, boolean distinct)
    • findIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<ID> findIds(YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
    • findIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<ID> findIds(tech.ydb.yoj.repository.db.Range<ID> range)
      Specified by:
      findIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • findIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<ID> findIds(Set<ID> partialIds)
      Specified by:
      findIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • update

      public void update(tech.ydb.yoj.repository.db.Entity.Id<T> id, tech.ydb.yoj.repository.db.statement.Changeset changeset)
      Specified by:
      update in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • insert

      public T insert(T t)
      Specified by:
      insert in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • save

      public T save(T t)
      Specified by:
      save in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • delete

      public void delete(tech.ydb.yoj.repository.db.Entity.Id<T> id)
      Specified by:
      delete in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • migrate

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> void migrate(ID id)
      Migrates the specified entity and its projections, if any. Does nothing if the entity does not exist.
      If the entity has projections, its createProjections() method MUST NOT fail when called on a raw, non-post-loaded entity.
      Type Parameters:
      ID - entity ID type
      Parameters:
      id - entity ID
    • getFirstLevelCache

      public tech.ydb.yoj.repository.db.cache.FirstLevelCache getFirstLevelCache()
      Specified by:
      getFirstLevelCache in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • postLoad

      @NonNull public T postLoad(T e)
      Specified by:
      postLoad in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • updateIn

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> void updateIn(Collection<ID> ids, tech.ydb.yoj.repository.db.statement.Changeset changeset)