Module org.jooq
Package org.jooq

Interface AttachableQueryPart

All Superinterfaces:
Attachable, QueryPart, Serializable
All Known Subinterfaces:
AlterDatabaseFinalStep, AlterDomainDropConstraintCascadeStep, AlterDomainFinalStep, AlterIndexFinalStep, AlterSchemaFinalStep, AlterSequenceFinalStep, AlterSequenceFlagsStep<T>, AlterSequenceStep<T>, AlterTableAddStep, AlterTableDropStep, AlterTableFinalStep, AlterTableUsingIndexStep, AlterTypeFinalStep, AlterViewFinalStep, Block, CallArgsStep, CommentOnFinalStep, CreateDatabaseFinalStep, CreateDomainConstraintStep, CreateDomainDefaultStep<T>, CreateDomainFinalStep, CreateIndexFinalStep, CreateIndexIncludeStep, CreateIndexWhereStep, CreateSchemaFinalStep, CreateSequenceFinalStep, CreateSequenceFlagsStep, CreateTableColumnStep, CreateTableCommentStep, CreateTableConstraintStep, CreateTableFinalStep, CreateTableIndexStep, CreateTableOnCommitStep, CreateTableStorageStep, CreateTableWithDataStep, CreateTypeFinalStep, CreateViewFinalStep, DDLQuery, Delete<R>, DeleteConditionStep<R>, DeleteFinalStep<R>, DeleteLimitStep<R>, DeleteOrderByStep<R>, DeleteQuery<R>, DeleteResultStep<R>, DeleteReturningStep<R>, DeleteUsingStep<R>, DeleteWhereStep<R>, DMLQuery<R>, DropDatabaseFinalStep, DropDomainCascadeStep, DropDomainFinalStep, DropIndexCascadeStep, DropIndexFinalStep, DropIndexOnStep, DropSchemaFinalStep, DropSchemaStep, DropSequenceFinalStep, DropTableFinalStep, DropTableStep, DropTypeFinalStep, DropTypeStep, DropViewFinalStep, GrantFinalStep, GrantWithGrantOptionStep, Insert<R>, InsertFinalStep<R>, InsertOnConflictConditionStep<R>, InsertOnConflictWhereStep<R>, InsertOnDuplicateSetMoreStep<R>, InsertOnDuplicateStep<R>, InsertQuery<R>, InsertResultStep<R>, InsertReturningStep<R>, InsertSetMoreStep<R>, InsertValuesStep1<R,​T1>, InsertValuesStep10<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10>, InsertValuesStep11<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11>, InsertValuesStep12<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12>, InsertValuesStep13<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13>, InsertValuesStep14<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14>, InsertValuesStep15<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15>, InsertValuesStep16<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16>, InsertValuesStep17<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17>, InsertValuesStep18<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18>, InsertValuesStep19<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19>, InsertValuesStep2<R,​T1,​T2>, InsertValuesStep20<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20>, InsertValuesStep21<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20,​T21>, InsertValuesStep22<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20,​T21,​T22>, InsertValuesStep3<R,​T1,​T2,​T3>, InsertValuesStep4<R,​T1,​T2,​T3,​T4>, InsertValuesStep5<R,​T1,​T2,​T3,​T4,​T5>, InsertValuesStep6<R,​T1,​T2,​T3,​T4,​T5,​T6>, InsertValuesStep7<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7>, InsertValuesStep8<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>, InsertValuesStep9<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9>, InsertValuesStepN<R>, Merge<R>, MergeFinalStep<R>, MergeMatchedDeleteStep<R>, MergeMatchedSetMoreStep<R>, MergeMatchedStep<R>, MergeMatchedWhereStep<R>, MergeNotMatchedSetMoreStep<R>, MergeNotMatchedStep<R>, MergeNotMatchedWhereStep<R>, MergeOnConditionStep<R>, Queries, Query, ResultQuery<R>, RevokeFinalStep, RowCountQuery, Select<R>, SelectConditionStep<R>, SelectConnectByAfterStartWithConditionStep<R>, SelectConnectByConditionStep<R>, SelectConnectByStep<R>, SelectCorrelatedSubqueryStep<R>, SelectDistinctOnStep<R>, SelectFinalStep<R>, SelectForJSONCommonDirectivesStep<R>, SelectForStep<R>, SelectForUpdateOfStep<R>, SelectForUpdateStep<R>, SelectForUpdateWaitStep<R>, SelectForXMLCommonDirectivesStep<R>, SelectForXMLPathDirectivesStep<R>, SelectForXMLRawDirectivesStep<R>, SelectFromStep<R>, SelectGroupByStep<R>, SelectHavingConditionStep<R>, SelectHavingStep<R>, SelectIntoStep<R>, SelectJoinStep<R>, SelectLimitAfterOffsetStep<R>, SelectLimitPercentAfterOffsetStep<R>, SelectLimitPercentStep<R>, SelectLimitStep<R>, SelectOffsetStep<R>, SelectOnConditionStep<R>, SelectOptionalOnStep<R>, SelectOptionStep<R>, SelectOrderByStep<R>, SelectQualifyConditionStep<R>, SelectQualifyStep<R>, SelectQuery<R>, SelectSeekLimitStep<R>, SelectSeekStep1<R,​T1>, SelectSeekStep10<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10>, SelectSeekStep11<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11>, SelectSeekStep12<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12>, SelectSeekStep13<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13>, SelectSeekStep14<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14>, SelectSeekStep15<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15>, SelectSeekStep16<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16>, SelectSeekStep17<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17>, SelectSeekStep18<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18>, SelectSeekStep19<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19>, SelectSeekStep2<R,​T1,​T2>, SelectSeekStep20<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20>, SelectSeekStep21<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20,​T21>, SelectSeekStep22<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20,​T21,​T22>, SelectSeekStep3<R,​T1,​T2,​T3>, SelectSeekStep4<R,​T1,​T2,​T3,​T4>, SelectSeekStep5<R,​T1,​T2,​T3,​T4,​T5>, SelectSeekStep6<R,​T1,​T2,​T3,​T4,​T5,​T6>, SelectSeekStep7<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7>, SelectSeekStep8<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>, SelectSeekStep9<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9>, SelectSeekStepN<R>, SelectSelectStep<R>, SelectStartWithStep<R>, SelectUnionStep<R>, SelectWhereStep<R>, SelectWindowStep<R>, SelectWithTiesAfterOffsetStep<R>, SelectWithTiesStep<R>, StoreQuery<R>, Truncate<R>, TruncateCascadeStep<R>, TruncateFinalStep<R>, TruncateIdentityStep<R>, Update<R>, UpdateConditionStep<R>, UpdateFinalStep<R>, UpdateFromStep<R>, UpdateLimitStep<R>, UpdateOrderByStep<R>, UpdateQuery<R>, UpdateResultStep<R>, UpdateReturningStep<R>, UpdateSetMoreStep<R>, UpdateWhereStep<R>

public interface AttachableQueryPart extends Attachable, QueryPart
A type that is both Attachable and a QueryPart.

In addition to being able to render SQL of possibly some unspecified dialect and with inlined bind values for debugging purposes via the QueryPart.toString() method, this type offers more fine-grained control over the SQL generation via ParamType, Configuration.dialect() and various Configuration.settings().

Author:
Lukas Eder
  • Method Details

    • getSQL

      @NotNull @NotNull String getSQL()
      Retrieve the SQL code rendered by this Query.

      Use this method, when you want to use jOOQ for object oriented query creation, but execute the query with some other technology, such as

      • JDBC
      • Spring Templates
      • JPA native queries
      • etc...

      Note, this is the same as calling getSQL(ParamType). The parameter will depend on your DSLContext's Settings:

      StatementType boolean parameter effect
      StatementType.PREPARED_STATEMENT false (default) This will render bind variables to be used with a JDBC PreparedStatement. You can extract bind values from this Query using getBindValues()
      StatementType.STATIC_STATEMENT true This will inline all bind variables in a statement to be used with a JDBC Statement

      [#1520] Note that the query actually being executed might not contain any bind variables, in case the number of bind variables exceeds your SQL dialect's maximum number of supported bind variables. This is not reflected by this method, which will only use the Settings to decide whether to render bind values.

      See Also:
      getSQL(ParamType)
    • getSQL

      @NotNull @NotNull String getSQL(ParamType paramType)
      Retrieve the SQL code rendered by this Query.

      [#1520] Note that the query actually being executed might not contain any bind variables, in case the number of bind variables exceeds your SQL dialect's maximum number of supported bind variables. This is not reflected by this method, which will only use paramType argument to decide whether to render bind values.

      See getSQL() for more details.

      Parameters:
      paramType - How to render parameters. This overrides values in Settings.getStatementType()
      Returns:
      The generated SQL
    • getBindValues

      @NotNull @NotNull List<Object> getBindValues()
      Retrieve the bind values that will be bound by this Query.

      Unlike getParams(), which returns also inlined parameters, this returns only actual bind values that will render an actual bind value as a question mark "?"

      See Also:
      DSLContext.extractBindValues(QueryPart)
    • getParams

      @NotNull @NotNull Map<String,​Param<?>> getParams()
      Get a Map of named parameters. The Map itself cannot be modified, but the Param elements allow for modifying bind values on an existing Query.

      Bind values created with DSL.val(Object) will have their bind index as name.

      See Also:
      Param, DSL.param(String, Object), DSLContext.extractParams(QueryPart)
    • getParam

      @Nullable @Nullable Param<?> getParam(String name)
      Get a named parameter from the Query, provided its name.

      Bind values created with DSL.val(Object) will have their bind index as name.

      See Also:
      Param, DSL.param(String, Object), DSLContext.extractParam(QueryPart, String)