Class QueryTableMapping<S,​Q extends FlexibleRelationalPathBase<R>,​R>

    • Constructor Detail

      • QueryTableMapping

        protected QueryTableMapping​(@NotNull
                                    @NotNull String tableName,
                                    @NotNull
                                    @NotNull String defaultAliasName,
                                    @NotNull
                                    @NotNull Class<S> schemaType,
                                    @NotNull
                                    @NotNull Class<Q> queryType,
                                    @NotNull
                                    @NotNull SqlRepoContext repositoryContext)
        Creates metamodel for the table described by designated type (Q-class) related to schema type. Allows registration of any number of columns - typically used for static properties (non-extensions).
        Parameters:
        tableName - database table name
        defaultAliasName - default alias name, some short abbreviation, must be unique across mapped types
    • Method Detail

      • stringMapper

        protected ItemSqlMapper<Q,​R> stringMapper​(Function<Q,​com.querydsl.core.types.dsl.StringPath> rootToQueryItem)
        Returns the mapper creating the string filter processor from context.
      • integerMapper

        public ItemSqlMapper<Q,​R> integerMapper​(Function<Q,​com.querydsl.core.types.dsl.NumberPath<Integer>> rootToQueryItem)
        Returns the mapper creating the integer filter processor from context.
      • longMapper

        public ItemSqlMapper<Q,​R> longMapper​(Function<Q,​com.querydsl.core.types.dsl.NumberPath<Long>> rootToQueryItem)
        Returns the mapper creating the long filter processor from context.
      • booleanMapper

        protected ItemSqlMapper<Q,​R> booleanMapper​(Function<Q,​com.querydsl.core.types.dsl.BooleanPath> rootToQueryItem)
        Returns the mapper creating the boolean filter processor from context.
      • uuidMapper

        protected ItemSqlMapper<Q,​R> uuidMapper​(Function<Q,​UuidPath> rootToQueryItem)
        Returns the mapper creating the OID (UUID) filter processor from context.
      • timestampMapper

        protected <T extends Comparable<T>> ItemSqlMapper<Q,​R> timestampMapper​(Function<Q,​com.querydsl.core.types.dsl.DateTimePath<T>> rootToQueryItem)
        Returns the mapper function creating the timestamp filter processor from context.
        Type Parameters:
        T - actual data type of the query path storing the timestamp
      • polyStringMapper

        protected ItemSqlMapper<Q,​R> polyStringMapper​(Function<Q,​com.querydsl.core.types.dsl.StringPath> origMapping,
                                                            Function<Q,​com.querydsl.core.types.dsl.StringPath> normMapping)
        Returns the mapper creating the string filter processor from context.
      • addDetailFetchMapper

        @Deprecated
        public final void addDetailFetchMapper​(ItemName itemName,
                                               SqlDetailFetchMapper<R,​?,​?,​?> detailFetchMapper)
        Deprecated.
        Fetcher/mappers for detail tables take care of loading to-many details related to this mapped entity (master). One fetcher per detail type/table is registered under the related item name. Used only in old-repo audit, we will let it die with that - but don't use in new stuff. Use createRowTransformer(SqlQueryContext, JdbcSession) mechanism instead.
        Parameters:
        itemName - item name from schema type that is mapped to detail table in the repository
        detailFetchMapper - fetcher-mapper that handles loading of details
        See Also:
        SqlDetailFetchMapper
      • joinOn

        protected <TQ extends FlexibleRelationalPathBase<TR>,​TR> BiFunction<Q,​TQ,​com.querydsl.core.types.Predicate> joinOn​(BiFunction<Q,​TQ,​com.querydsl.core.types.Predicate> joinOnPredicateFunction)
        Lambda "wrapper" that helps with the type inference (namely the current Q type). Returned bi-function returns ON condition predicate for two entity paths.
        Type Parameters:
        TQ - query type for the JOINed (target) table
        TR - row type related to the QueryTableMapping
      • tableName

        public String tableName()
      • defaultAliasName

        public String defaultAliasName()
      • newAlias

        public Q newAlias​(String alias)
        Creates new alias (entity path instance) with a defined name. You can also use defaultAlias() if one alias in a query is enough. Entity path instance returned by this call is already enhanced by extension columns.
      • newAliasInstance

        protected abstract Q newAliasInstance​(String alias)
        Method returning new instance of EntityPath - to be implemented by sub-mapping. This will create entity path without any extension columns, see newAlias(java.lang.String) for that.
      • defaultAlias

        public Q defaultAlias()
        Returns default alias - use only once per query, e.g. not for two different joins. Also, don't cache it yourself, always use this method which ensures that the alias has all the extension columns configured properly.
      • addExtensionColumn

        public void addExtensionColumn​(String propertyName,
                                       com.querydsl.sql.ColumnMetadata columnMetadata)
        Registers extension columns. At this moment all are treated as strings.
      • getExtensionColumns

        public Map<String,​com.querydsl.sql.ColumnMetadata> getExtensionColumns()
      • selectExpressionsWithCustomColumns

        @NotNull
        public @NotNull com.querydsl.core.types.Path<?>[] selectExpressionsWithCustomColumns​(Q entity)
      • newRowObject

        public R newRowObject()