Class SqlSelector

java.lang.Object
org.litebridge.orm.api.select.impl.AbstractSelector<Row,SqlSelectSpec>
org.litebridge.orm.api.sql.SqlSelector
All Implemented Interfaces:
SelectTerminal<Row>

public final class SqlSelector extends org.litebridge.orm.api.select.impl.AbstractSelector<Row,SqlSelectSpec>
  • Constructor Details

  • Method Details

    • createSelectSpec

      protected SqlSelectSpec createSelectSpec(AliasGenerator aliasGenerator)
      Specified by:
      createSelectSpec in class org.litebridge.orm.api.select.impl.AbstractSelector<Row,SqlSelectSpec>
    • select

      public SqlFromClause select(ExpressionSpec... expressionSpecs)
    • withNode

      public SqlSelector withNode(QueryNode node)
      Description copied from class: org.litebridge.orm.api.select.impl.AbstractSelector
      Sets the current node to the specified query node.
      Specified by:
      withNode in class org.litebridge.orm.api.select.impl.AbstractSelector<Row,SqlSelectSpec>
      Parameters:
      node - the new query node
      Returns:
      the selector instance
    • oneOrNull

      public @Nullable Row oneOrNull()
      Description copied from interface: SelectTerminal
      Executes the query and expects exactly one result.
      Specified by:
      oneOrNull in interface SelectTerminal<Row>
      Specified by:
      oneOrNull in class org.litebridge.orm.api.select.impl.AbstractSelector<Row,SqlSelectSpec>
      Returns:
      the single result, or null when no row matches
    • firstOrNull

      public @Nullable Row firstOrNull()
      Description copied from interface: SelectTerminal
      Executes the query and returns the first row if present.
      Specified by:
      firstOrNull in interface SelectTerminal<Row>
      Specified by:
      firstOrNull in class org.litebridge.orm.api.select.impl.AbstractSelector<Row,SqlSelectSpec>
      Returns:
      the first result, or null when no row matches
    • list

      public List<Row> list()
      Description copied from interface: SelectTerminal
      Executes the query and materializes all results into a List.
      Specified by:
      list in interface SelectTerminal<Row>
      Specified by:
      list in class org.litebridge.orm.api.select.impl.AbstractSelector<Row,SqlSelectSpec>
      Returns:
      list of all matching results (possibly empty)