Class FromClauseEngine

java.lang.Object
org.litebridge.orm.engine.FromClauseEngine

public final class FromClauseEngine extends Object
The FromClauseEngine class represents the generation of SQL "FROM" clauses with support for both DTO-based and raw expression-based queries.

It acts as a builder for specifying the table and columns to be used in a query, while also managing aliasing, context, and relationships between entities.

This class depends on various components such as a database provider, table registry, change tracker, DTO constructor, and context supplier to construct SQL queries effectively.

This class is immutable and thread-safe. Instances of this class should not be modified after construction.

  • Field Details

    • ALL_COLUMNS

      public static final Aliased[] ALL_COLUMNS
      Used to indicate that all fields or expressions should be selected.
  • Constructor Details

  • Method Details

    • from

      public <DTO> DtoFromClauseTerminal<DTO> from(ExpressionSpec[] expressionSpecs, Class<DTO> dtoClass, @Nullable RelatedDtoStrategy relatedDtoStrategy)
      Constructs a DTO-based FROM clause.
      Type Parameters:
      DTO - the DTO type.
      Parameters:
      expressionSpecs - the expression specifications.
      dtoClass - the DTO class.
      relatedDtoStrategy - the related DTO strategy.
      Returns:
      the DTO from clause terminal.
    • from

      public <TypeOverride> DtoFromClauseTerminal<TypeOverride> from(ExpressionSpec[] expressionSpecs, Class<?> dtoClass, Class<TypeOverride> typeOverrideClass, @Nullable RelatedDtoStrategy relatedDtoStrategy)
      Constructs a DTO-based FROM clause with a type override.
      Type Parameters:
      TypeOverride - the type override.
      Parameters:
      expressionSpecs - the expression specifications.
      dtoClass - the DTO class.
      typeOverrideClass - the type override class.
      relatedDtoStrategy - the related DTO strategy.
      Returns:
      the DTO from clause terminal.
    • from

      public <DTO> DtoFromClauseTerminal<DTO> from(Class<DTO> dtoClass, Class<?> contextDtoClass)
      Constructs a DTO-based FROM clause using a context DTO class.
      Type Parameters:
      DTO - the DTO type.
      Parameters:
      dtoClass - the DTO class.
      contextDtoClass - the context DTO class.
      Returns:
      the DTO from clause terminal.
    • from

      public SqlFromClauseTerminal from(ExpressionSpec[] expressionSpecs, String table)
      Constructs an SQL-based FROM clause.
      Parameters:
      expressionSpecs - the expression specifications.
      table - the table name.
      Returns:
      the SQL from clause terminal.