java.lang.Object
org.litebridge.orm.engine.FromClauseEngine
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Aliased[]Used to indicate that all fields or expressions should be selected. -
Constructor Summary
ConstructorsConstructorDescriptionFromClauseEngine(TransactionalDatabaseProvider databaseProvider, TableRegistry tableRegistry, ChangeTracker changeTracker, DtoConstructor dtoConstructor, Supplier<LitebridgeContext> contextSupplier) Constructs a newFromClauseEngine. -
Method Summary
Modifier and TypeMethodDescription<DTO> DtoFromClauseTerminal<DTO> Constructs a DTO-based FROM clause using a context DTO class.<TypeOverride>
DtoFromClauseTerminal<TypeOverride> from(ExpressionSpec[] expressionSpecs, Class<?> dtoClass, Class<TypeOverride> typeOverrideClass, @Nullable RelatedDtoStrategy relatedDtoStrategy) Constructs a DTO-based FROM clause with a type override.<DTO> DtoFromClauseTerminal<DTO> from(ExpressionSpec[] expressionSpecs, Class<DTO> dtoClass, @Nullable RelatedDtoStrategy relatedDtoStrategy) Constructs a DTO-based FROM clause.from(ExpressionSpec[] expressionSpecs, String table) Constructs an SQL-based FROM clause.
-
Field Details
-
ALL_COLUMNS
Used to indicate that all fields or expressions should be selected.
-
-
Constructor Details
-
FromClauseEngine
public FromClauseEngine(TransactionalDatabaseProvider databaseProvider, TableRegistry tableRegistry, ChangeTracker changeTracker, DtoConstructor dtoConstructor, Supplier<LitebridgeContext> contextSupplier) Constructs a newFromClauseEngine.- Parameters:
databaseProvider- the database provider.tableRegistry- the table registry.changeTracker- the change tracker.dtoConstructor- the DTO constructor.contextSupplier- the context supplier.
-
-
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
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
Constructs an SQL-based FROM clause.- Parameters:
expressionSpecs- the expression specifications.table- the table name.- Returns:
- the SQL from clause terminal.
-